What are the various mechanisms using which we can detect if a process execution is leading to memory fragmentation?
Are there any tools available for the same? Suggestion for tools which work with 'C' code and can run on Windows, Linux and VxWorks will be helpful.
You can measure fragmentation directly by looking at /proc/buddyinfo which will tell you how many free chunks are available on each zone of each NUMA node per each order. You can do a little math and calculate what percentage of free memory is available for allocations of a certain order.
Reducing the number of sizes between these extremes also helps. Employing sizes that increase logarithmically saves a lot of fragmentation. For example, each size could be 20% larger than the previous size. “One size fits all” might not be true for memory allocators in embedded system.
This problem occurs when you allocate RAM to processes continuously. It is done in paging and segmentation, where memory is allocated to processes non-contiguously. As a result, if you remove this condition, external fragmentation may be decreased. Compaction is another method for removing external fragmentation.
Fragmentation is more likely to be a problem when your application makes a series of allocations and deallocations such that each time an allocation is made it cannot re-use space that was left by a previous deallocation of a similar (or larger) size block.
Just as a suggestion, you may want to try Valgrind. I'm not certain it's what you're looking for, but it may come in handy.
http://valgrind.org/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With