Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Memory leak bug in the Java bindings
29-04-2013, 10:06 AM
Post: #1
Memory leak bug in the Java bindings
I've found a memory leak bug in the JNI code for the Java bindings. Some local object references are being allocated and never freed, and this causes the process to run out of memory.

The following files are affected:
OpenHome/Net/Bindings/Java/CpDeviceList.c
OpenHome/Net/Bindings/Java/CpProxy.c
OpenHome/Net/Bindings/Java/DvDevice.c
OpenHome/Net/Bindings/Java/DvDeviceStandard.c
OpenHome/Net/Bindings/Java/DvProvider.c
OpenHome/Net/Bindings/Java/InitParams.c
OpenHome/Net/Bindings/Java/Invocation.c
OpenHome/Net/Bindings/Java/Property.c

I've produced a patch (attached) and I've tested this to verify that it fixes the problem.

I found this problem while investigating another occurrence of the "QNAP hang" problem, and I'm fairly sure the hang is caused by an out-of-memory condition resulting from this bug.


Attached File(s)
.zip  jnimemleak.zip (Size: 3.06 KB / Downloads: 3)
Find all posts by this user
30-04-2013, 09:03 AM
Post: #2
RE: Memory leak bug in the Java bindings
(29-04-2013 10:06 AM)simoncn Wrote:  I've found a memory leak bug in the JNI code for the Java bindings. Some local object references are being allocated and never freed, and this causes the process to run out of memory.

The following files are affected:
OpenHome/Net/Bindings/Java/CpDeviceList.c
OpenHome/Net/Bindings/Java/CpProxy.c
OpenHome/Net/Bindings/Java/DvDevice.c
OpenHome/Net/Bindings/Java/DvDeviceStandard.c
OpenHome/Net/Bindings/Java/DvProvider.c
OpenHome/Net/Bindings/Java/InitParams.c
OpenHome/Net/Bindings/Java/Invocation.c
OpenHome/Net/Bindings/Java/Property.c

I've produced a patch (attached) and I've tested this to verify that it fixes the problem.

I found this problem while investigating another occurrence of the "QNAP hang" problem, and I'm fairly sure the hang is caused by an out-of-memory condition resulting from this bug.

Thanks for spotting this! I've applied the fix as suggested.
Find all posts by this user
30-04-2013, 10:02 AM
Post: #3
RE: Memory leak bug in the Java bindings
(30-04-2013 09:03 AM)simonc Wrote:  Thanks for spotting this! I've applied the fix as suggested.

Thanks very much!
Find all posts by this user


Forum Jump: