[zeromq-dev] Memory leak(?) between Push/Pull
Charles Remes
lists at chuckremes.com
Thu Dec 6 15:05:46 CET 2012
On Dec 6, 2012, at 6:46 AM, Stefan de Konink <stefan at konink.de> wrote:
> Given the following scenario;
>
> A system is pushing messages, while not being connected to a pull.
>
> The pushing system does not have a high water mark.
>
> When the pull system is enabled, the messages are received.
>
> But the memory that was used to buffer the messages at the pushing system
> is not being freed.
>
>
> Wouldn't it be better to reduce the buffers again?
The memory is being deallocated. Let me guess something… you are running on linux. There is a long standing and well known issue when you call free() on linux. Though you are giving the memory block back to the OS, the OS continues to "charge" your process for the space. BTW, this problem also exists on OSX to a lesser extent.
Take a look on stackoverflow and search for "malloc fragmentation" and related issues. I ran into this problem a few years ago with zeromq and even tried replacing the system malloc with other libraries that had better fragmentation handling (tcmalloc, jemalloc). While they reduced the problem, they do not eliminate it.
cr
More information about the zeromq-dev
mailing list