Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Memory leak & slowdown
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-06-05 (14:00)
From: Dawid Toton <d0@w...>
Subject: Memory leak & slowdown
I have an OCaml program using GTK running on Windows, using multiple 

The overall memory usage grows significantly over time, but I don't know 
why. After it consumes several MB extra, it slows considerably and 
becomes unusable, so I have to fix this.

Is it possible that this is related to GC compaction being turned off? 
Additional calls to Gc.compact seemingly don't help.

The memory usage grows only when the main processing loop is working. 
After the function exists, the memory is not freed. Moreover, if I start 
it again, it 'reuses' the leaked memory. The second execution of the 
loop takes more memory only after it takes more time than the previous one.

This made me thinking that it's just some container growing but not 
shrinking. So I checked my toplevel values with the objsize library, but 
I managed to trace down only a fraction of the allocated memory and the 
sizes I get don't grow.

How to do memory profiling?

The program can have about 10MB of useful data and 200MB of something I 
don't know. How to check what is this?