why `top` report is not consistent with the memory freed by core.stdc.stdlib : free?

mw mingwu at gmail.com
Fri Nov 6 06:17:42 UTC 2020


Hi,

I'm trying this:

https://wiki.dlang.org/Memory_Management#Explicit_Class_Instance_Allocation

using core.stdc.stdlib : malloc and free to manually manage 
memory, I tested two scenarios:

-- malloc & free
-- malloc only

and I use Linux command `top` to check the memory used by the 
program, there is no difference in this two scenarios.

I also tried to use `new` to allocate the objects, and GC.free(). 
The memory number reported by `top` is much less than those 
reported by using core.stdc.stdlib : malloc and free.


I'm wondering why? shouldn't core.stdc.stdlib : malloc and free 
be more raw (low-level) than new & GC.free()? why `top` shows 
stdlib free() is not quite working?

thanks.


More information about the Digitalmars-d-learn mailing list