Dynamic memory allocation approaches for C++ apps - pros and cons
Angelo Fraietta
newsgroups at smartcontroller.com.au
Sun Dec 2 00:38:46 UTC 2007
Robert S. Grimes wrote:
> Hi,
>
> I'm just looking for some advice and pointers here - no specific
> problems (yet!)...
>
> What are the relative pros and cons of the various available dynamic
> memory allocation approaches in modern RTEMS applications? One choice
> is the C++ operators new/delete, which presumably call malloc and free
> under the covers. What are the characteristics wrt determinism,
> fragmentation, etc.?
It depends on what your requirements are.
I had to develop a per class allocator due to the number of allocations
and deallocations I was making. I found that using the heap, my app
froze after about 2 days running (it was doing 100 allocations and
deallocations per second) due to memory fragmentation.
After implementing my allocator for each class, through overloading
operators new and delete in each class, my app ran two weeks without
incident with the same number of allocations and deallocations.
--
Dr Angelo Fraietta
A.Eng, A.Mus.A, BA(Hons), Ph.D.
PO Box 859
Hamilton NSW 2303
Home Page
http://www.smartcontroller.com.au/
There are those who seek knowledge for the sake of knowledge - that is
CURIOSITY
There are those who seek knowledge to be known by others - that is VANITY
There are those who seek knowledge in order to serve - that is LOVE
Bernard of Clairvaux (1090 - 1153)
More information about the users
mailing list