Hacker News new | ask | show | jobs
by hga 4761 days ago
Manual deallocation of a heap???
1 comments

Sorry, I don't follow.
Are you allocating from and deallocating to a heap?

If so, I've heard that can result in non-optimal results, that would also require dynamic analysis to avoid unacceptable worst cases.

By 'non-optimal results' do you mean heap fragmentation?

If so then yes that's a major concern with dynamic memory allocation in real-time environments. These systems must be designed to run continuously for years at a time and have limited memory, so any allocator that causes non-zero heap fragmentation is right out.

There are allocators that don't do that. One way is to use a pool allocator which allocates fixed-size blocks. Since all blocks are the same size, fragmentation can't occur.