You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a simple test that fails for me on the debug build.
I get the error:
[foonathan::memory] Assertion failure in function allocate (.../foonathan-memory/src/detail/free_list.cpp:444): Assertion "last_dealloc_prev_ == prev" failed.
I am not sure if this is a genuine error that the debug build is detecting, or if it is an error introduced by the different behavior present in debug builds...
typedef foonathan::memory::memory_pool<> MyPool;
MyPool pool(100, 1024);
auto p1 = pool.allocate_node();
auto p2 = pool.allocate_node();
pool.deallocate_node(p1);
pool.deallocate_node(p2);
p1 = pool.allocate_node();
p2 = pool.allocate_node(); // <-- assertion happens here
pool.deallocate_node(p1);
pool.deallocate_node(p2);
The text was updated successfully, but these errors were encountered:
Thanks for catching that one! It seems this has been a bug for years, but as it only happens if you deallocate in the exact same order that you allocated (and most containers destroy in reverse order), nobody ran into it before, apparently.
I've expanded the tests as well: previously, they tested only one "random" ordering of allocations and deallocations, now they do same order and reverse order as well.
Below is a simple test that fails for me on the debug build.
I get the error:
I am not sure if this is a genuine error that the debug build is detecting, or if it is an error introduced by the different behavior present in debug builds...
The text was updated successfully, but these errors were encountered: