How to detect free/unfree memory segments?

jkpl via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 23 17:15:43 PST 2016


On Friday, 23 December 2016 at 06:18:02 UTC, Suliman wrote:
> I would like to visualize how GC works and display free/not 
> free memory segments.
> How I can understand which of them are used and which not?
>
> Could anybody explain what dangerous of memory fragmentation in 
> languages without GC? Am I right understand that there is stay 
> some small memory chunks that very hard to reuse?

You start with a wrong assumption. The C malloc functions is not 
just a nasty and mean memory provider. Several implementations 
uses internally freelists. Which means that the gaps created by a 
free() may be filled again.

For example
- TCMallocator use free lists
- GCC C malloc use free lists (as stated here 
http://www.gnu.org/software/libc/manual/html_node/Freeing-after-Malloc.html)
- for snn.lib malloc (used by DMD win32) I can't say.


More information about the Digitalmars-d-learn mailing list