I’m not familiar with how the Linux heap is allocated.
I’m calling malloc()/free() many many times a second, always with the same sizes (there are about 10 structs, each fixed size). Aside from init time, none of my memory remains allocated for long periods of time.
Is this considered poor form with the standard heaps? (I’m sure someone will ask ‘what heap are you using?’ – ‘Ugh. The standard static heap’ ..meaning I’m unsure.)
Should I instead use a free list or does the heap tolerate lots of the same allocations. I’m trying to balance readability with performance.
Any tools to help me measure?
Valgrind has a special tool Massif for measuring memory usage. This should help to profile heap allocations.