I have an application that uses memory both from Nim code and from linked 
libraries. After a section of Nim code, I use `GC_fullCollect()`, and 
`GC_getStatistics()` gives the following before and after the collect.
    
    
    [GC] total memory: 81081118720
    [GC] occupied memory: 54716248088
    [GC] stack scans: 557345
    [GC] stack cells: 77
    [GC] cycle collections: 8
    [GC] max threshold: 78399625696
    [GC] zct capacity: 1024
    [GC] max cycle table size: 0
    [GC] max pause time [ms]: 0
    [GC] max stack size: 4656
    
    [GC] total memory: 81081118720
    [GC] occupied memory: 6419767248
    [GC] stack scans: 557346
    [GC] stack cells: 77
    [GC] cycle collections: 9
    [GC] max threshold: 78399625696
    [GC] zct capacity: 1024
    [GC] max cycle table size: 0
    [GC] max pause time [ms]: 0
    [GC] max stack size: 4656

which is OK from Nim's point of view. The operating system, however, still 
thinks the process uses more than 50 GB of memory. Now the code calls an 
external library, and the library failed at `malloc` at some point, which ends 
up killing the whole process.

How can I actually release the memory?

Reply via email to