Skip to content

Commit b9dd8ea

Browse files
authored
Reduce stdafx.h header inclusion to avoid running out of memory on *nix boxes in Pipelines (#906)
* Pare down stdafx.h to avoid running out of memory on the Linux builders with ninja. * Remove ninja -j.
1 parent acd96cf commit b9dd8ea

File tree

15 files changed

+32
-34
lines changed

15 files changed

+32
-34
lines changed

Release/include/cpprest/asyncrt_utils.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@
1313

1414
#pragma once
1515

16-
#include <string>
17-
#include <vector>
16+
#include <chrono>
1817
#include <cstdint>
19-
#include <system_error>
2018
#include <random>
19+
#include <string>
20+
#include <system_error>
21+
#include <vector>
2122
#include <locale.h>
2223
#include <limits.h>
2324
#include "pplx/pplxtasks.h"
2425
#include "cpprest/details/basic_types.h"
2526

26-
#if !defined(_WIN32) || (_MSC_VER >= 1700)
27-
#include <chrono>
28-
#endif
29-
3027
#ifndef _WIN32
3128
#include <sys/time.h>
3229
#if !defined(ANDROID) && !defined(__ANDROID__) && defined(HAVE_XLOCALE_H) // CodePlex 269

Release/src/http/client/http_client_asio.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
****/
1515

1616
#include "stdafx.h"
17+
#include <sstream>
1718

1819
#include "../common/internal_http_helpers.h"
1920
#include "cpprest/asyncrt_utils.h"

Release/src/http/common/http_msg.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1212
****/
1313
#include "stdafx.h"
14+
#include <sstream>
1415
#include "../common/internal_http_helpers.h"
16+
#include "cpprest/producerconsumerstream.h"
1517

1618
using namespace web;
1719
using namespace utility;

Release/src/http/listener/http_server_asio.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
*/
1515
#include "stdafx.h"
1616

17+
#include <sstream>
18+
#include <set>
1719
#include <boost/algorithm/string/find.hpp>
1820
#include <boost/algorithm/string/predicate.hpp>
1921
#include <boost/asio/read_until.hpp>

Release/src/http/listener/http_server_httpsys.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
****/
1515

1616
#include "stdafx.h"
17+
#include "cpprest/rawptrstream.h"
1718

1819
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
1920

Release/src/http/oauth/oauth2.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include "stdafx.h"
1515

16+
#include <sstream>
17+
1618
using web::http::client::http_client;
1719
using web::http::client::http_client_config;
1820
using web::http::oauth2::details::oauth2_strings;

Release/src/pch/stdafx.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
#include <stdint.h>
5050
#include <cstdint>
5151
#include <string>
52-
#include <sstream>
53-
#include <thread>
5452
#include <atomic>
5553
#include <signal.h>
5654
#include "pthread.h"
@@ -75,33 +73,21 @@
7573
// This is to help track how many developers are directly building from source themselves.
7674
#define _CASA_BUILD_FROM_SRC
7775

78-
#include <iostream>
79-
#include <fstream>
8076
#include <algorithm>
8177
#include <exception>
8278
#include <assert.h>
83-
#include <streambuf>
8479
#include <atomic>
8580
#include <mutex>
8681
#include <array>
8782
#include <vector>
8883
#include <memory>
89-
#include <thread>
90-
#include <set>
9184

9285
#include "cpprest/details/cpprest_compat.h"
9386
#include "cpprest/details/basic_types.h"
9487

9588
#include "pplx/pplxtasks.h"
9689
#include "cpprest/version.h"
9790

98-
// streams
99-
#include "cpprest/streams.h"
100-
#include "cpprest/astreambuf.h"
101-
#include "cpprest/rawptrstream.h"
102-
#include "cpprest/interopstream.h"
103-
#include "cpprest/producerconsumerstream.h"
104-
10591
// json
10692
#include "cpprest/json.h"
10793

@@ -124,10 +110,6 @@
124110
#endif
125111
#include "cpprest/oauth2.h"
126112

127-
// websockets
128-
#include "cpprest/ws_client.h"
129-
#include "cpprest/ws_msg.h"
130-
131113
#if !defined(__cplusplus_winrt)
132114
#if _WIN32_WINNT >= _WIN32_WINNT_VISTA
133115
#include "cpprest/details/http_server.h"

Release/src/pplx/pplxlinux.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "pplx/pplx.h"
1616
#include "pplx/threadpool.h"
1717
#include "sys/syscall.h"
18+
#include <thread>
1819

1920
#ifdef _WIN32
2021
#error "ERROR: This file should only be included in non-windows Build"

Release/src/uri/uri.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include "stdafx.h"
1515

16+
#include <sstream>
17+
1618
using namespace utility::conversions;
1719

1820
namespace web { namespace details

Release/src/uri/uri_builder.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include "stdafx.h"
1515

16+
#include <sstream>
17+
1618
namespace web
1719
{
1820

@@ -120,8 +122,8 @@ bool uri_builder::is_valid()
120122
return uri::validate(m_uri.join());
121123
}
122124

123-
void uri_builder::append_query_encode_impl(const utility::string_t & name, const utf8string & value)
124-
{
125+
void uri_builder::append_query_encode_impl(const utility::string_t & name, const utf8string & value)
126+
{
125127
utility::string_t encodedQuery = uri::encode_query_impl(utility::conversions::to_utf8string(name));
126128
encodedQuery.append(_XPLATSTR("="));
127129
encodedQuery.append(uri::encode_query_impl(value));
@@ -130,8 +132,8 @@ void uri_builder::append_query_encode_impl(const utility::string_t & name, const
130132
append_query(encodedQuery, false);
131133
}
132134

133-
void uri_builder::append_query_no_encode_impl(const utility::string_t & name, const utility::string_t & value)
134-
{
135+
void uri_builder::append_query_no_encode_impl(const utility::string_t & name, const utility::string_t & value)
136+
{
135137
append_query(name + _XPLATSTR("=") + value, false);
136138
}
137139

Release/src/utilities/asyncrt_utils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <cpprest/asyncrt_utils.h>
1616
#include <algorithm>
1717
#include <string>
18+
#include <sstream>
1819

1920
#ifndef _WIN32
2021
#if defined(__clang__)

Release/src/websockets/client/ws_client.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1010
****/
1111
#include "stdafx.h"
12+
#include "cpprest/ws_client.h"
1213

1314
#if !defined(CPPREST_EXCLUDE_WEBSOCKETS)
1415

@@ -91,4 +92,4 @@ pplx::task<websocket_incoming_message> websocket_client_task_impl::receive()
9192

9293
}}}}
9394

94-
#endif
95+
#endif

Release/src/websockets/client/ws_client_wspp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
****/
1313

1414
#include "stdafx.h"
15+
#include <thread>
1516

1617
#if !defined(CPPREST_EXCLUDE_WEBSOCKETS)
1718

Release/src/websockets/client/ws_msg.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1414
****/
1515
#include "stdafx.h"
16+
#include <sstream>
17+
#include "cpprest/ws_client.h"
18+
#include "cpprest/ws_msg.h"
1619
#include "../../http/common/internal_http_helpers.h"
1720

1821
#if !defined(CPPREST_EXCLUDE_WEBSOCKETS)

azure-pipelines.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Debug ..'
1919
- script: |
2020
cd build.debug
21-
ninja -j 4
21+
ninja
2222
displayName: 'Run ninja'
2323
- script: |
2424
cd build.debug/Release/Binaries
@@ -41,7 +41,7 @@ jobs:
4141
cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release ..'
4242
- script: |
4343
cd build.release
44-
ninja -j 4
44+
ninja
4545
displayName: 'Run ninja'
4646
- script: |
4747
cd build.release/Release/Binaries
@@ -61,7 +61,7 @@ jobs:
6161
cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Debug ..'
6262
- script: |
6363
cd build.debug
64-
ninja -j 4
64+
ninja
6565
displayName: 'Run ninja'
6666
- script: |
6767
cd build.debug/Release/Binaries
@@ -81,7 +81,7 @@ jobs:
8181
cmakeArgs: '-G Ninja -DCMAKE_BUILD_TYPE=Release ..'
8282
- script: |
8383
cd build.release
84-
ninja -j 4
84+
ninja
8585
displayName: 'Run ninja'
8686
- script: |
8787
cd build.release/Release/Binaries

0 commit comments

Comments
 (0)