JDK-6200343 : memory leak in many jni calls (NewString etc.)
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 5.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2004-11-25
  • Updated: 2010-05-11
  • Resolved: 2004-12-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
1.4.2_08Fixed 6Fixed
Description
In deploy/src/plugin/solaris/nscore/remotejni.cpp, there are several places where call malloc but don't call free. The affected methods are:

jni_CallStaticVoidMethodV
DEFINE_CAPTURESCALARARRAYELEMENTS
DEFINE_SETSCALARARRAYELEMENTS
jni_NewString
jni_NewStringUTF
jni_CSecurityContextImplies

When doing liveconnect call, mozilla will call jni_NewString to convert js string to java string, sometimes, the js string is very large, it will cause serious mozilla memory growth.

This problem also exists in 1.4.2.


Comments
EVALUATION DEFINE_CAPTURESCALARARRAYELEMENTS does not call memory leak, the memory allocated by it will be release by other JNI function. Other functions actually cause memory leak. Also there some mismatched AddRef() and Rlease() , they cause memory leak too ###@###.### 2004-11-25 09:30:48 GMT some leaks also exist in server.c ###@###.### 2004-11-30 11:05:14 GMT
25-11-2004