Sign in to follow this  

using STL with memory managed code

This topic is 3771 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm using a game engine that supplies overrides of the C++ allocation operators. I verified in my debugger that the linker is linking external libraries' calls to allocation operators to the overrides, instead of the standard implementation. Is this going to be a problem? I'm more worried about data corruption and weird side effects than I am about performance.

Share this post


Link to post
Share on other sites
You can provide all of the STL container your own custom allocator. Just write one that uses your overrides and you'll be fine. You might be fine anyway if your override declaration occurs before the inclusion of the STL class; your own custom allocator would probably be safer

-me

Share this post


Link to post
Share on other sites
You can always write some sample code using the custom memory management and then check it with valgrind (or similar tool) to see if there are any memory leaks or mismatched new-deletes/malloc-frees.

However I would personally avoid "overriding" STL allocators, unless I really what I was doing. Besides global new/delete operators are often overloaded for debugging/logging purposes and this would be probably pointless with STL. It would just pollute your logs needlessly, since we don't suspect our STL implementations from beaing leaky, do we?

Share this post


Link to post
Share on other sites
I too second the write test code to verify, this is ALWAYS a good idea and never hurts.

Also, its not the STL anymore unless you're using a very old compiler, it's now the SC++L, short for Standard C++ Library.

Share this post


Link to post
Share on other sites

This topic is 3771 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this