Subject: Memory leak on mac

Memory leak on mac

From: Velichko Yuriy <>
Date: Tue, 16 Feb 2016 19:43:05 +0200


I have application, that among other things, checks accessibility of the
remote machine by connecting over ssh. The app immediately disconnect when
connection is confirmed. All works fine on Mac and Windows. But on mac the
app takes more and more memory (on windows is all right). The instruments
for XCode shows that memory is leak in function


but I do not call this function directly anywhere.

To release ssh handlers methods are used:

libssh2_channel_free( );
libssh2_session_disconnect( );
libssh2_session_free( );

All of them works without errors.

IMPOTANT NOTE: the leak occur when session works in non-blocking mode:

libssh2_session_set_blocking( ..., 0);

if to use

libssh2_session_set_blocking( ..., 1);

There is no leak.

Tell me please what a difference. What I doing wrong? Or may be this is a
little bug in libssh2?

Received on 2016-02-16