Skip to content

Commit 240e4c9

Browse files
committed
Move helper implementations to .cpp for MSVC heap exhaustion fix
- interactions_helpers.hpp now contains only forward declarations (92 lines) - interactions_helpers.cpp contains implementations (1825 lines) - Helpers compiled as static library, test parts link against it - This prevents MSVC from processing all helpers for each test file
1 parent 97125c5 commit 240e4c9

3 files changed

Lines changed: 1879 additions & 1784 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,29 +233,33 @@ if(FASTMCPP_BUILD_TESTS)
233233
target_link_libraries(fastmcpp_server_patterns PRIVATE fastmcpp_core)
234234
add_test(NAME fastmcpp_server_patterns COMMAND fastmcpp_server_patterns)
235235

236-
# Server interactions split into 6 parts to avoid MSVC heap exhaustion
236+
# Server interactions helpers library (compiled separately to avoid MSVC heap exhaustion)
237+
add_library(fastmcpp_interactions_helpers STATIC tests/server/interactions_helpers.cpp)
238+
target_link_libraries(fastmcpp_interactions_helpers PRIVATE fastmcpp_core)
239+
240+
# Server interactions split into 6 parts
237241
add_executable(fastmcpp_server_interactions_p1 tests/server/interactions_p1.cpp)
238-
target_link_libraries(fastmcpp_server_interactions_p1 PRIVATE fastmcpp_core)
242+
target_link_libraries(fastmcpp_server_interactions_p1 PRIVATE fastmcpp_core fastmcpp_interactions_helpers)
239243
add_test(NAME fastmcpp_server_interactions_p1 COMMAND fastmcpp_server_interactions_p1)
240244

241245
add_executable(fastmcpp_server_interactions_p2 tests/server/interactions_p2.cpp)
242-
target_link_libraries(fastmcpp_server_interactions_p2 PRIVATE fastmcpp_core)
246+
target_link_libraries(fastmcpp_server_interactions_p2 PRIVATE fastmcpp_core fastmcpp_interactions_helpers)
243247
add_test(NAME fastmcpp_server_interactions_p2 COMMAND fastmcpp_server_interactions_p2)
244248

245249
add_executable(fastmcpp_server_interactions_p3 tests/server/interactions_p3.cpp)
246-
target_link_libraries(fastmcpp_server_interactions_p3 PRIVATE fastmcpp_core)
250+
target_link_libraries(fastmcpp_server_interactions_p3 PRIVATE fastmcpp_core fastmcpp_interactions_helpers)
247251
add_test(NAME fastmcpp_server_interactions_p3 COMMAND fastmcpp_server_interactions_p3)
248252

249253
add_executable(fastmcpp_server_interactions_p4 tests/server/interactions_p4.cpp)
250-
target_link_libraries(fastmcpp_server_interactions_p4 PRIVATE fastmcpp_core)
254+
target_link_libraries(fastmcpp_server_interactions_p4 PRIVATE fastmcpp_core fastmcpp_interactions_helpers)
251255
add_test(NAME fastmcpp_server_interactions_p4 COMMAND fastmcpp_server_interactions_p4)
252256

253257
add_executable(fastmcpp_server_interactions_p5 tests/server/interactions_p5.cpp)
254-
target_link_libraries(fastmcpp_server_interactions_p5 PRIVATE fastmcpp_core)
258+
target_link_libraries(fastmcpp_server_interactions_p5 PRIVATE fastmcpp_core fastmcpp_interactions_helpers)
255259
add_test(NAME fastmcpp_server_interactions_p5 COMMAND fastmcpp_server_interactions_p5)
256260

257261
add_executable(fastmcpp_server_interactions_p6 tests/server/interactions_p6.cpp)
258-
target_link_libraries(fastmcpp_server_interactions_p6 PRIVATE fastmcpp_core)
262+
target_link_libraries(fastmcpp_server_interactions_p6 PRIVATE fastmcpp_core fastmcpp_interactions_helpers)
259263
add_test(NAME fastmcpp_server_interactions_p6 COMMAND fastmcpp_server_interactions_p6)
260264

261265
add_executable(fastmcpp_server_context_meta tests/server/context_meta.cpp)

0 commit comments

Comments
 (0)