Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/Kernel/Containers/list_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,16 @@ TEST_CASE ("contains") {
CHECK_EQ (contains (normal, 2L), true);
CHECK_EQ (contains (normal, 3L), true);
}

TEST_CASE ("long list under stack size") {
int initial_mem_used= mem_used ();
cout << "Initial mem used: " << initial_mem_used << LF;
list<string> long_l;
// increase the size to 5000, there will be a stackoverflow on Windows
for (int i= 0; i < 4000; i++) {
long_l= list<string> ("88888888", long_l);
}
int final_mem_used= mem_used ();
cout << "Final mem used: " << final_mem_used << LF;
cout << "Actual mem used: " << final_mem_used - initial_mem_used << LF;
}
3 changes: 3 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ function add_test_target(filepath)
if is_plat("windows") then
add_cxxflags("/utf-8")
add_ldflags("/LTCG")
-- https://learn.microsoft.com/en-us/cpp/build/reference/stack-stack-allocations?view=msvc-170
-- explicitly set stack size to 1M on windows
add_ldflags("/STACK:1048576")
end

if is_plat("windows") or is_plat("mingw") then
Expand Down