[sip-comm-dev] [PATCH] Memory Leak in Sip handling code (repost)


#1

Hello!

I've earlier posted these patches for memory leaks, but they don't seem to
have been picked up. Perhaps this happened because I posted them in a thread
about a potential memory leak in the JAIN SIP library, while my changes
apply to the SIP Communicator code. Maybe you are interested in including
the changes before the alpha 2 release, so I thought to post again.

MediaServiceImpl keeps a reference to every CallSessionImpl which is ever
created. There's a TODO comment to remove closed calls :wink: The patch goes
the simplest route and simply comments out the line which adds the newly
created callSession to the list of activeCallSessions, which can be done
because activeCallSessions is not used. Perhaps activeCallSessions coud be
removed completely until the time it is needed?

The second patch deallocates and closes the players created during a
CallSession, which are currently only stopped.

The third patch decreases the impact of a memory leak in the SUN JMF
implementation, which stores custom codec formats in a static Vector and
thus never releases them even if the RTP manager on which the format is
registered is released.

I've found the patch by setting the JVM startup parameter
-XX:+HeapDumpOnOutOfMemoryError and then using Abbot (http://abbot.sf.net/)
to repeatedly start and end calls until I got an OutOfMemory error. I
analyzed the resulting heap dump with jhat, which is part of the JDK 1.6
(see http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html).
Unfortunately, the Abbot scripts which I've used won't work with the plain
SIP Communicator, since I've been testing with our in-house application,
which merely calls out to the SIP Communicator SIP module.

Regards
Michael Koch

memleak-MediaServiceImpl.patch (725 Bytes)

memleak-CallSessionImpl-1.patch (559 Bytes)

memleak-CallSessionImpl-2.patch (1.91 KB)


#2

Hello Michael,

Thanks for your patches!

Koch Michael wrote:

Hello!

I've earlier posted these patches for memory leaks,

Yes, I remember.

but they don't seem to have been picked up.

My bad, I apologize! I'll try to commit them first thing tomorrow morning.

Thanks for your patience, and thank you for resubmitting them!

Emil

···

Perhaps this happened because I posted them in a thread
about a potential memory leak in the JAIN SIP library, while my changes
apply to the SIP Communicator code. Maybe you are interested in including
the changes before the alpha 2 release, so I thought to post again.

MediaServiceImpl keeps a reference to every CallSessionImpl which is ever
created. There's a TODO comment to remove closed calls :wink: The patch goes
the simplest route and simply comments out the line which adds the newly
created callSession to the list of activeCallSessions, which can be done
because activeCallSessions is not used. Perhaps activeCallSessions coud be
removed completely until the time it is needed?

The second patch deallocates and closes the players created during a
CallSession, which are currently only stopped.

The third patch decreases the impact of a memory leak in the SUN JMF
implementation, which stores custom codec formats in a static Vector and
thus never releases them even if the RTP manager on which the format is
registered is released.

I've found the patch by setting the JVM startup parameter
-XX:+HeapDumpOnOutOfMemoryError and then using Abbot (http://abbot.sf.net/)
to repeatedly start and end calls until I got an OutOfMemory error. I
analyzed the resulting heap dump with jhat, which is part of the JDK 1.6
(see http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html).
Unfortunately, the Abbot scripts which I've used won't work with the plain
SIP Communicator, since I've been testing with our in-house application,
which merely calls out to the SIP Communicator SIP module.

Regards
Michael Koch

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#3

Actually, Michael, could you please open 3 issues (one per patch) in the
Issue Tracker on java.net, just to make sure that we don't forget them
for alpha2?

Thanks!
Emil

Emil Ivov wrote:

···

Hello Michael,

Thanks for your patches!

Koch Michael wrote:

Hello!

I've earlier posted these patches for memory leaks,

Yes, I remember.

but they don't seem to have been picked up.

My bad, I apologize! I'll try to commit them first thing tomorrow morning.

Thanks for your patience, and thank you for resubmitting them!

Emil

Perhaps this happened because I posted them in a thread
about a potential memory leak in the JAIN SIP library, while my changes
apply to the SIP Communicator code. Maybe you are interested in including
the changes before the alpha 2 release, so I thought to post again.

MediaServiceImpl keeps a reference to every CallSessionImpl which is ever
created. There's a TODO comment to remove closed calls :wink: The patch goes
the simplest route and simply comments out the line which adds the newly
created callSession to the list of activeCallSessions, which can be done
because activeCallSessions is not used. Perhaps activeCallSessions coud be
removed completely until the time it is needed?

The second patch deallocates and closes the players created during a
CallSession, which are currently only stopped.

The third patch decreases the impact of a memory leak in the SUN JMF
implementation, which stores custom codec formats in a static Vector and
thus never releases them even if the RTP manager on which the format is
registered is released.

I've found the patch by setting the JVM startup parameter
-XX:+HeapDumpOnOutOfMemoryError and then using Abbot (http://abbot.sf.net/)
to repeatedly start and end calls until I got an OutOfMemory error. I
analyzed the resulting heap dump with jhat, which is part of the JDK 1.6
(see http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html).
Unfortunately, the Abbot scripts which I've used won't work with the plain
SIP Communicator, since I've been testing with our in-house application,
which merely calls out to the SIP Communicator SIP module.

Regards
Michael Koch

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#4

Actually, Michael, could you please open 3 issues (one per
patch) in the
Issue Tracker on java.net, just to make sure that we don't forget them
for alpha2?

Done:
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=385
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=386
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=387

···

Thanks!
Emil

Emil Ivov wrote:
> Hello Michael,
>
> Thanks for your patches!
>
> Koch Michael wrote:
>> Hello!
>>
>> I've earlier posted these patches for memory leaks,
>
> Yes, I remember.
>
>> but they don't seem to have been picked up.
>
> My bad, I apologize! I'll try to commit them first thing
tomorrow morning.
>
> Thanks for your patience, and thank you for resubmitting them!
>
> Emil
>
>> Perhaps this happened because I posted them in a thread
>> about a potential memory leak in the JAIN SIP library,
while my changes
>> apply to the SIP Communicator code. Maybe you are
interested in including
>> the changes before the alpha 2 release, so I thought to post again.
>>
>> MediaServiceImpl keeps a reference to every
CallSessionImpl which is ever
>> created. There's a TODO comment to remove closed calls :wink:
The patch goes
>> the simplest route and simply comments out the line which
adds the newly
>> created callSession to the list of activeCallSessions,
which can be done
>> because activeCallSessions is not used. Perhaps
activeCallSessions coud be
>> removed completely until the time it is needed?
>>
>> The second patch deallocates and closes the players
created during a
>> CallSession, which are currently only stopped.
>>
>> The third patch decreases the impact of a memory leak in
the SUN JMF
>> implementation, which stores custom codec formats in a
static Vector and
>> thus never releases them even if the RTP manager on which
the format is
>> registered is released.
>>
>> I've found the patch by setting the JVM startup parameter
>> -XX:+HeapDumpOnOutOfMemoryError and then using Abbot
(http://abbot.sf.net/)
>> to repeatedly start and end calls until I got an
OutOfMemory error. I
>> analyzed the resulting heap dump with jhat, which is part
of the JDK 1.6
>> (see
http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html).
>> Unfortunately, the Abbot scripts which I've used won't
work with the plain
>> SIP Communicator, since I've been testing with our
in-house application,
>> which merely calls out to the SIP Communicator SIP module.
>>
>> Regards
>> Michael Koch


#5

Hello Michael,

I have just committed and acked your fixed! Thanks!

Could you please have a look (the updated code is available in both the
trunk and alpha2 trees) and let me know what you think?

I'll close the issues right after that.

Cheers
Emil

Koch Michael wrote:

···

Actually, Michael, could you please open 3 issues (one per
patch) in the
Issue Tracker on java.net, just to make sure that we don't forget them
for alpha2?

Done:
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=385
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=386
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=387

Thanks!
Emil

Emil Ivov wrote:

Hello Michael,

Thanks for your patches!

Koch Michael wrote:

Hello!

I've earlier posted these patches for memory leaks,

Yes, I remember.

but they don't seem to have been picked up.

My bad, I apologize! I'll try to commit them first thing

tomorrow morning.

Thanks for your patience, and thank you for resubmitting them!

Emil

Perhaps this happened because I posted them in a thread
about a potential memory leak in the JAIN SIP library,

while my changes

apply to the SIP Communicator code. Maybe you are

interested in including

the changes before the alpha 2 release, so I thought to post again.

MediaServiceImpl keeps a reference to every

CallSessionImpl which is ever

created. There's a TODO comment to remove closed calls :wink:

The patch goes

the simplest route and simply comments out the line which

adds the newly

created callSession to the list of activeCallSessions,

which can be done

because activeCallSessions is not used. Perhaps

activeCallSessions coud be

removed completely until the time it is needed?

The second patch deallocates and closes the players

created during a

CallSession, which are currently only stopped.

The third patch decreases the impact of a memory leak in

the SUN JMF

implementation, which stores custom codec formats in a

static Vector and

thus never releases them even if the RTP manager on which

the format is

registered is released.

I've found the patch by setting the JVM startup parameter
-XX:+HeapDumpOnOutOfMemoryError and then using Abbot

(http://abbot.sf.net/)

to repeatedly start and end calls until I got an

OutOfMemory error. I

analyzed the resulting heap dump with jhat, which is part

of the JDK 1.6

(see

http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html).

Unfortunately, the Abbot scripts which I've used won't

work with the plain

SIP Communicator, since I've been testing with our

in-house application,

which merely calls out to the SIP Communicator SIP module.

Regards
Michael Koch

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net


#6

Thats great
   
  Thanks
   
Emil Ivov <emcho@sip-communicator.org> a �crit :
  Hello Michael,

I have just committed and acked your fixed! Thanks!

Could you please have a look (the updated code is available in both the
trunk and alpha2 trees) and let me know what you think?

I'll close the issues right after that.

Cheers
Emil

Koch Michael wrote:

···

Actually, Michael, could you please open 3 issues (one per
patch) in the
Issue Tracker on java.net, just to make sure that we don't forget them
for alpha2?

Done:
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=385
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=386
https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=387

Thanks!
Emil

Emil Ivov wrote:

Hello Michael,

Thanks for your patches!

Koch Michael wrote:

Hello!

I've earlier posted these patches for memory leaks,

Yes, I remember.

but they don't seem to have been picked up.

My bad, I apologize! I'll try to commit them first thing

tomorrow morning.

Thanks for your patience, and thank you for resubmitting them!

Emil

Perhaps this happened because I posted them in a thread
about a potential memory leak in the JAIN SIP library,

while my changes

apply to the SIP Communicator code. Maybe you are

interested in including

the changes before the alpha 2 release, so I thought to post again.

MediaServiceImpl keeps a reference to every

CallSessionImpl which is ever

created. There's a TODO comment to remove closed calls :wink:

The patch goes

the simplest route and simply comments out the line which

adds the newly

created callSession to the list of activeCallSessions,

which can be done

because activeCallSessions is not used. Perhaps

activeCallSessions coud be

removed completely until the time it is needed?

The second patch deallocates and closes the players

created during a

CallSession, which are currently only stopped.

The third patch decreases the impact of a memory leak in

the SUN JMF

implementation, which stores custom codec formats in a

static Vector and

thus never releases them even if the RTP manager on which

the format is

registered is released.

I've found the patch by setting the JVM startup parameter
-XX:+HeapDumpOnOutOfMemoryError and then using Abbot

(http://abbot.sf.net/)

to repeatedly start and end calls until I got an

OutOfMemory error. I

analyzed the resulting heap dump with jhat, which is part

of the JDK 1.6

(see

http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html).

Unfortunately, the Abbot scripts which I've used won't

work with the plain

SIP Communicator, since I've been testing with our

in-house application,

which merely calls out to the SIP Communicator SIP module.

Regards
Michael Koch

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail: dev-help@sip-communicator.dev.java.net

---------------------------------
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail


#7

I have just committed and acked your fixed! Thanks!

Could you please have a look (the updated code is available
in both the
trunk and alpha2 trees) and let me know what you think?

It's fine with me. I'm glad to be of help.

Regards
Michael Koch

···

I'll close the issues right after that.

Cheers
Emil

Koch Michael wrote:
>> Actually, Michael, could you please open 3 issues (one per
>> patch) in the
>> Issue Tracker on java.net, just to make sure that we don't
forget them
>> for alpha2?
>
> Done:
> https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=385
> https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=386
> https://sip-communicator.dev.java.net/issues/show_bug.cgi?id=387
>
>
>> Thanks!
>> Emil
>>
>> Emil Ivov wrote:
>>> Hello Michael,
>>>
>>> Thanks for your patches!
>>>
>>> Koch Michael wrote:
>>>> Hello!
>>>>
>>>> I've earlier posted these patches for memory leaks,
>>> Yes, I remember.
>>>
>>>> but they don't seem to have been picked up.
>>> My bad, I apologize! I'll try to commit them first thing
>> tomorrow morning.
>>> Thanks for your patience, and thank you for resubmitting them!
>>>
>>> Emil
>>>
>>>> Perhaps this happened because I posted them in a thread
>>>> about a potential memory leak in the JAIN SIP library,
>> while my changes
>>>> apply to the SIP Communicator code. Maybe you are
>> interested in including
>>>> the changes before the alpha 2 release, so I thought to
post again.
>>>>
>>>> MediaServiceImpl keeps a reference to every
>> CallSessionImpl which is ever
>>>> created. There's a TODO comment to remove closed calls :wink:
>> The patch goes
>>>> the simplest route and simply comments out the line which
>> adds the newly
>>>> created callSession to the list of activeCallSessions,
>> which can be done
>>>> because activeCallSessions is not used. Perhaps
>> activeCallSessions coud be
>>>> removed completely until the time it is needed?
>>>>
>>>> The second patch deallocates and closes the players
>> created during a
>>>> CallSession, which are currently only stopped.
>>>>
>>>> The third patch decreases the impact of a memory leak in
>> the SUN JMF
>>>> implementation, which stores custom codec formats in a
>> static Vector and
>>>> thus never releases them even if the RTP manager on which
>> the format is
>>>> registered is released.
>>>>
>>>> I've found the patch by setting the JVM startup parameter
>>>> -XX:+HeapDumpOnOutOfMemoryError and then using Abbot
>> (http://abbot.sf.net/)
>>>> to repeatedly start and end calls until I got an
>> OutOfMemory error. I
>>>> analyzed the resulting heap dump with jhat, which is part
>> of the JDK 1.6
>>>> (see
>> http://java.sun.com/javase/6/docs/technotes/tools/share/jhat.html).
>>>> Unfortunately, the Abbot scripts which I've used won't
>> work with the plain
>>>> SIP Communicator, since I've been testing with our
>> in-house application,
>>>> which merely calls out to the SIP Communicator SIP module.
>>>>
>>>> Regards
>>>> Michael Koch

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@sip-communicator.dev.java.net
For additional commands, e-mail:
dev-help@sip-communicator.dev.java.net