GC memory fragmentation

frame frame86 at live.com
Mon Apr 12 00:58:44 UTC 2021


On Sunday, 11 April 2021 at 09:10:22 UTC, tchaloupka wrote:
> Hi,
> we're using vibe-d (on Linux) for a long running REST API 
> server and have problem with constantly growing memory until 
> system kills it with OOM killer.

Do you have a manual GC.free() in your code, maybe with a larger 
array?

>
> Only explanation that makes some sense is that in some 
> operation there is required memory allocations that can't be 
> fulfilled with current memory pool (ie due to the memory 
> fragmentation in it) and then it allocates some data in new 
> memory segment that can't be returned afterwards as it still 
> holds the 'live' data. But that should be freed too at some 
> point and GC should minimize (if another request doesn'cause 
> allocation in the 'wrong' page again).

If so, setting minPoolSize:1 could help you to control the memory 
usage, and if this memory is kept, you could inspect whats inside 
the particular pool item (at least for GC allocated stuff).




More information about the Digitalmars-d-learn mailing list