Removing Large number of objects from vector immediately.

Started by
19 comments, last by SolDirix 10 years, 1 month ago

Well, Every time I allocate all 65,536 Objects to the list, it happens very quickly, however deleting the list actually takes around 5 seconds, and I don't know why sad.png.

I switched to release mode and disables Secure Scl, and it improved, but not by much.

Since you mention SCL I assume you are using Visual Studio. Are you running your program with F5 or with Ctrl+F5? It is not the same.

When you run your program with Visual Studio hooked to your process memory allocation / deallocation is far slower. (EVEN if you are in Release mode). This is thanks to the so-called DEBUG HEAP smile.png

I have a ~15 seconds delay (Visual Studio 2012, Release Mode, Win64) when running with F5, but the code runs instantaneously when using Ctrl+F5 (AKA: running the program process independently of VS).

Look at this question of Stack Overflow for more information: http://stackoverflow.com/questions/6486282/set-no-debug-heap (it is tagged as C#... but it is not a C# question).

PS: Regardless, using a custom stack memory allocator (http://molecularmusings.wordpress.com/2012/08/27/memory-allocation-strategies-a-stack-like-lifo-allocator/) might be a good optimization is you see that you have a bottleneck here. But as always, MEASURE before optimizing. Remember that "optimization is the root of all evil (Donnald Knuth)" ;)

Oh My Gosh, you have found the answer X3 thank you so much it is now instantaneous thanks! I have been using F5 instead of Ctrl-F5. I never knew about this so called Debug Heap :/.

View my game dev blog here!

This topic is closed to new replies.

Advertisement