www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: Memory leak on mac

Re: Memory leak on mac

From: Velichko Yuriy <velichko.yuriy_at_gmail.com>
Date: Wed, 17 Feb 2016 16:18:59 +0200

In the attached example:
if
 libssh2_session_set_blocking(session, 0);
memory usage is increased.
else if
libssh2_session_set_blocking(session, 1);
the app uses the constant amount of memory.

On 17 February 2016 at 16:04, Velichko Yuriy <velichko.yuriy_at_gmail.com>
wrote:

> In the attached archive an example based on libssh2 docs:
>
> http://www.libssh2.org/examples/tcpip-forward.html
>
> In the attached code the port forwarding is implemented. In the infinity
> loop we preforms port forwarding of the PostgreSQL port on the remote
> computer. In the end of the loop all resources are freeing.
>
> But memory increases constantly.
>
> I think that I'm doing something wrong. Tell me please what exactly? )
>
> On 16 February 2016 at 20:05, Velichko Yuriy <velichko.yuriy_at_gmail.com>
> wrote:
>
>> I will create a simple example in nearest time.
>>
>> On 16 February 2016 at 19:52, Will Cosgrove <will_at_panic.com> wrote:
>>
>>> You’ll need to post an example app showing this leak; I use libssh2 on
>>> the Mac and have done extensive profiling and it does not leak in my use
>>> cases.
>>>
>>> Will
>>>
>>> On Feb 16, 2016, at 9:43 AM, Velichko Yuriy <velichko.yuriy_at_gmail.com>
>>> wrote:
>>>
>>> Hello!
>>>
>>> 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
>>>
>>> libssh2_default_alloc
>>>
>>> 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?
>>>
>>> _______________________________________________
>>> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>>>
>>>
>>>
>>> _______________________________________________
>>> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>>>
>>>
>>
>>
>> --
>> ​С уважением, Величко Юрий.
>>
>
>
>
> --
> ​С уважением, Величко Юрий.
>

-- 
​С уважением, Величко Юрий.

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2016-02-17

the libssh2 team