Consider using reset() for fast container teardown - Best pratices
MasterDrake opened this issue · 2 comments
Hi, I was trying to apply the best practice of using a custom stack allocator to tear down quickly a container but to no avail.

Apparently, reset() has been renamed to reset_lose_memory(), so IMO that should be corrected, to avoid further confusion for other users.
Also, the snippet you provided does not compile as PPMalloc StackAllocator does not provide a "deallocate" function, since that function is called on the containers' destructor.
I'd love to know what can I do to fix that or what I'm getting wrong.
Thanks and sorry to bother you!
I'll update the documentation to reset_lose_memory() for the next release.
I can't comment on the stack allocator implementation as that isn't EA provided code. I don't know the history of why EA didn't do a public release of PPMalloc.
For a custom allocator (std library compatible or otherwise) you could possibly write an adaptor to make it compatible with eastl's allocator requirements (std and eastl allocators aren't equivalent, see here).
Thank you!