About Store Forum Documentation Contact



Post Reply 
Memory containers behavior
Author Message
Abril Offline
Member

Post: #1
Memory containers behavior
Hello, I was wondering if anybody knows what is the behavoir of the EE memory containers compared to STL in regards to allocations (otherwise I have to use STL to reduce memory allocations).

For example if I do:

Memb<int> list1;

every frame:
// clear the list and add elements
list1.clear();
list1.New(20);
...

Imagine a typical situation where every frame you clear the list at the beginning of the frame and then keep adding elements again, is new fresh memory allocated again for each new element, or is it just re-using the memory from previously allocated elements until they dont exceed the previous capacity of elements reached?

The function
"Memb& del (); // remove all elements and free helper memory"
seems to give a hint that calling clear() keeps the memory allocated sofar, but I'd like to get a confirmation about that...
02-02-2012 07:16 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Memory containers behavior
seems to give a hint that calling clear() keeps the memory allocated sofar
yes, it does
02-03-2012 11:27 PM
Find all posts by this user Quote this message in a reply
Post Reply