Opened 7 years ago

Closed 7 years ago

#1541 closed defect (fixed)

Memory is sometimes not released by free() in libc

Reported by: Dimitar Misev Owned by: Dimitar Misev
Priority: critical Milestone: 9.4
Component: rasserver Version: development
Keywords: Cc: Peter Baumann
Complexity: Medium

Description (last modified by Dimitar Misev)

It appears that in some cases memory is not really released and returned by free(). It's pretty complex and not very clear why. Especially with GB of allocated memory for tiles, this is a huge issue.

So far I've come across one solution of replacing the system malloc with tcmalloc or jemalloc; but this still doesn't seem to work in all cases, e.g. it works on Ubuntu 16.04, but not on Ubuntu 14.04.

Another solution I stumbled upon is to use malloc_trim() into trying to force release all free memory from the top of the heap. I've placed this in ObjectBroker::clearBroker() (called on transaction commit/abort), and this appears to work consistently.

Change History (2)

comment:1 by Dimitar Misev, 7 years ago

Description: modified (diff)

comment:2 by Dimitar Misev, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.