Duplicate :
|
|
Relates :
|
|
Relates :
|
Short description: Event Handle Leak while using JNI Operating System: Microsoft Windows OS version: 5.2.3790 Product Name: JRE Product version: java version "1.5.0_06" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05) Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing) Hardware platform: System Manufacturer FUJITSU SIEMENS System Model D1899 System Type X86-based PC Processor x86 Family 15 Model 4 Stepping 3 GenuineIntel ~3600 Mhz Processor x86 Family 15 Model 4 Stepping 3 GenuineIntel ~3600 Mhz Processor x86 Family 15 Model 4 Stepping 3 GenuineIntel ~3600 Mhz Processor x86 Family 15 Model 4 Stepping 3 GenuineIntel ~3600 Mhz BIOS Version/Date FUJITSU SIEMENS // Phoenix Technologies Ltd. 4.06 Rev. 1.05.1899, 6/27/2005 Hardware Abstraction Layer Version = "5.2.3790.1830 (srv03_sp1_rtm.050324-1447)" Total Physical Memory 2,046.93 MB Available Physical Memory 1.09 GB Total Virtual Memory 3.39 GB Available Virtual Memory 2.11 GB Page File Space 1.54 GB Page File D:\pagefile.sys Full problem description: The program contains a single thread that attaches and detaches from JNI in a loop. The loop-count and the sleep-time in the loop can be customized via command line arguments. Test case: The test progam is JniTest.zip Compile and Link the Test program Open the Task Manager in the machine and add the column "Handle" to the list of columns displayed. Start the test program Observe the Handle count for the process JNITest.exe It can be observed that the Handle count increases by two for every execution of the for loop. Each execution consists of one call AttachCurrentThread and DetahCurrentThread to JVM.Open "Process Explorer" from www.sysinternals.com and observe the type of handles used by the process JNITest.exe. It can be seen that the leak happens for the type "Event".
|