Ocaml 3.12.0., Lwt 2.3.1

On Apr 20, 2012 7:12 PM, "SerP" <serp256@gmail.com> wrote:

Hi!
We have developped a daemon on ocaml using the lwt lib(libev). It processes about 800 requests per second, but it increases to 2 Gb in memory for a hour of work. We have studied the problem for a long time, using mtrace, mallinfo and other tools, and we tried to change GC params. We found out that setting up GC.minor_heap_size=10Mb Á major_heap_increment=2íb will make the daemon grow slower. mallinfÏ shows that the memory (1,5G) is allocated using mmap (blkhd field in mallinfo struct) and arena size - about 20M In this case, first calls of GC.compact compress the daemon to 200 Mb (live -110Mb) , and mallinfo show decreasing of total size of memory allocated by mmap. The daemon keeps growing, but it allocates the memory to arena (using brk), and calls of GC.compact leads to decrease of heap_bytes to 200M, but arena size (1.5 Gb) does not decrease, just doing less uordblks and more fordblks (fileds I.e., after first calls of GC.compact, the daemon starts using brk much more than mmap, and cant memory given back to the system.

If Gc.allocation_policy is first fit, memory usage is stable, and it's grow very little, but worked very slowly.

Any suggestions are very welcome. Thanks