[gdal-dev] GDAL Java Binding meomory problem under intensive method calls

Even Rouault even.rouault at mines-paris.org
Thu Jan 5 12:06:35 EST 2012


Selon easyl <thlin.box at gmail.com>:

Could you create a completely self-contained code that could be used to compile
and reproduce ? It might be possible that you use the layers after the
datasource has been closed for example, but it is difficult to be sure without
seeing the exact code.

> GDAL 1.8.1 on Win64
>
> basically I just use ogr2ogr and ogrinfo from gdal/java examples.
>
> I wrote a test case with processing S57 (*000) data:
>
>    /* read layer information with ogrinfo */
>    final String param[] = { "-ro", "-al", src};
>    final List<Layer> layers = ogrinfo.execute(param); // I just collect
> "Layers" created by ogrinfo
>
>    /* convert each possible layer and geometry type  with ogr2ogr */
>    for (/* ... huge loop ...*/) {
>       param= new String[]{"-skipfailure", "-append", "-f","ESRI Shapefile",
> dest, src, "-nlt", type, layer};
>       ogr2ogr.excute(param);
>    }
>
>    /* then try to access Layer again */
>    layers.get(0).GetFeatureCount(); // XXX: it crashed here
>
> I append the error at the end of the post.
>
> It seems that the native lib has some memory reference issue or leak.
>
>
> =========================================
> =========================================
> =========================================
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fee8653ab3,
> pid=7364, tid=7396
> #
> # JRE version: 6.0_25-b06
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.0-b11 mixed mode
> windows-amd64 compressed oops)
> # Problematic frame:
> # C  [gdal18.dll+0x3c3ab3]
> #
> # If you would like to submit a bug report, please visit:
> #   http://java.sun.com/webapps/bugreport/crash.jsp
> # The crash happened outside the Java Virtual Machine in native code.
> # See problematic frame for where to report the bug.
> #
>
> ---------------  T H R E A D  ---------------
>
> Current thread (0x000000000035b800):  JavaThread "main" [_thread_in_native,
> id=7396, stack(0x0000000002630000,0x0000000002730000)]
>
> siginfo: ExceptionCode=0xc0000005, reading address 0xffffffffffffffff
>
> Registers:
> RAX=0x0000000000000085, RBX=0x0000000000000085, RCX=0x3b58414d4143533b,
> RDX=0x000000000687a3e2
> RSP=0x000000000272f720, RBP=0x0000000000000000, RSI=0x000000000967db10,
> RDI=0x0000000007be8d00
> R8 =0x0000000000000000, R9 =0x000000000272f748, R10=0x000007fee8371d0d,
> R11=0x000000000272f6b0
> R12=0x0000000007be8d00, R13=0x0000000000000000, R14=0x00000000091f67b0,
> R15=0x0000000000000003
> RIP=0x000007fee8653ab3, EFLAGS=0x0000000000010297
>
> Top of Stack: (sp=0x000000000272f720)
> 0x000000000272f720:   0000000000000004 000000000967db10
> 0x000000000272f730:   0000000007be8d00 00000000091f67b0
> 0x000000000272f740:   0000000000000000 0000000000000002
> 0x000000000272f750:   0000000007cbda30 000007fee86faea4
> 0x000000000272f760:   000000000035b800 0000000000000000
> 0x000000000272f770:   000000000272f958 0000000000000081
> 0x000000000272f780:   000000000967db10 000007fee8658586
> 0x000000000272f790:   0000000000000004 00000000091f67b0
> 0x000000000272f7a0:   0000000007be8d00 0000000000000001
> 0x000000000272f7b0:   0000000000000000 0000000000000002
> 0x000000000272f7c0:   fffffffffffffffe 0000000000000000
> 0x000000000272f7d0:   00000000bb52a7e8 0000000000000000
> 0x000000000272f7e0:   0000000000000e9d 000007fee8659256
> 0x000000000272f7f0:   0000000007be8d00 000000000272f928
> 0x000000000272f800:   0000000009244030 000000000967db10
> 0x000000000272f810:   0000000000000000 000007fee865d78f
>
> Instructions: (pc=0x000007fee8653ab3)
> 0x000007fee8653a93:   c3 d1 ff 48 63 d8 83 fb 01 0f 8c ed 00 00 00 49
> 0x000007fee8653aa3:   8b 0c 24 3b 59 30 0f 8f e0 00 00 00 48 8b 49 40
> 0x000007fee8653ab3:   48 8b 3c d9 48 85 ff 0f 84 cf 00 00 00 4c 8d 0d
> 0x000007fee8653ac3:   11 a2 31 00 48 8d 15 9a a2 31 00 45 33 c0 49 8b
>
>
> Register to memory mapping:
>
> RAX=0x0000000000000085 is an unknown value
> RBX=0x0000000000000085 is an unknown value
> RCX=0x3b58414d4143533b is an unknown value
> RDX=0x000000000687a3e2 is an unknown value
> RSP=0x000000000272f720 is pointing into the stack for thread:
> 0x000000000035b800
> RBP=0x0000000000000000 is an unknown value
> RSI=0x000000000967db10 is an unknown value
> RDI=0x0000000007be8d00 is an unknown value
> R8 =0x0000000000000000 is an unknown value
> R9 =0x000000000272f748 is pointing into the stack for thread:
> 0x000000000035b800
> R10=0x000007fee8371d0d is an unknown value
> R11=0x000000000272f6b0 is pointing into the stack for thread:
> 0x000000000035b800
> R12=0x0000000007be8d00 is an unknown value
> R13=0x0000000000000000 is an unknown value
> R14=0x00000000091f67b0 is an unknown value
> R15=0x0000000000000003 is an unknown value
>
>
> Stack: [0x0000000002630000,0x0000000002730000],  sp=0x000000000272f720,
> free space=1021k
> Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native
> code)
> C  [gdal18.dll+0x3c3ab3]  S57Reader::ApplyObjectClassAttributes+0xa3
>
> [error occurred during error reporting (printing native stack), id
> 0xc0000005]
>
> Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
> j
> org.gdal.ogr.ogrJNI.Layer_GetFeatureCount__SWIG_1(JLorg/gdal/ogr/Layer;)I+0
> j  org.gdal.ogr.Layer.GetFeatureCount()I+5
> j  org.gdal.TestViolation.main([Ljava/lang/String;)V+404
> v  ~StubRoutines::call_stub
>
> ---------------  P R O C E S S  ---------------
>
> Java Threads: ( => current thread )
>   0x0000000006371800 JavaThread "GeometryNativeObjectsCleaner" daemon
> [_thread_blocked, id=6876, stack(0x0000000009c80000,0x0000000009d80000)]
>   0x0000000006371000 JavaThread "FeatureNativeObjectsCleaner" daemon
> [_thread_blocked, id=8172, stack(0x0000000009b80000,0x0000000009c80000)]
>   0x0000000006370000 JavaThread "Low Memory Detector" daemon
> [_thread_blocked, id=7592, stack(0x0000000007550000,0x0000000007650000)]
>   0x0000000006361800 JavaThread "C2 CompilerThread1" daemon
> [_thread_blocked, id=4484, stack(0x0000000007450000,0x0000000007550000)]
>   0x000000000634b000 JavaThread "C2 CompilerThread0" daemon
> [_thread_blocked, id=3812, stack(0x0000000007350000,0x0000000007450000)]
>   0x000000000634a000 JavaThread "Attach Listener" daemon [_thread_blocked,
> id=7500, stack(0x0000000007250000,0x0000000007350000)]
>   0x0000000006349000 JavaThread "Signal Dispatcher" daemon [_thread_blocked,
> id=6784, stack(0x0000000007150000,0x0000000007250000)]
>   0x00000000062f8800 JavaThread "Finalizer" daemon [_thread_blocked,
> id=5980, stack(0x0000000007050000,0x0000000007150000)]
>   0x00000000062f2000 JavaThread "Reference Handler" daemon [_thread_blocked,
> id=7004, stack(0x0000000006f50000,0x0000000007050000)]
> =>0x000000000035b800 JavaThread "main" [_thread_in_native, id=7396,
> stack(0x0000000002630000,0x0000000002730000)]
>
> Other Threads:
>   0x00000000062e6000 VMThread [stack: 0x0000000006e50000,0x0000000006f50000]
> [id=7820]
>   0x0000000006399000 WatcherThread [stack:
> 0x0000000007650000,0x0000000007750000] [id=8160]
>
> VM state:not at safepoint (normal execution)
>
> VM Mutex/Monitor currently owned by a thread: None
>
> Heap
>  PSYoungGen      total 19072K, used 14187K [0x00000000eab60000,
> 0x00000000ec0a0000, 0x0000000100000000)
>   eden space 16384K, 86% used
> [0x00000000eab60000,0x00000000eb93aea0,0x00000000ebb60000)
>   from space 2688K, 0% used
> [0x00000000ebe00000,0x00000000ebe00000,0x00000000ec0a0000)
>   to   space 2688K, 0% used
> [0x00000000ebb60000,0x00000000ebb60000,0x00000000ebe00000)
>  PSOldGen        total 43648K, used 0K [0x00000000c0200000,
> 0x00000000c2ca0000, 0x00000000eab60000)
>   object space 43648K, 0% used
> [0x00000000c0200000,0x00000000c0200000,0x00000000c2ca0000)
>  PSPermGen       total 21248K, used 5628K [0x00000000bb000000,
> 0x00000000bc4c0000, 0x00000000c0200000)
>   object space 21248K, 26% used
> [0x00000000bb000000,0x00000000bb57f168,0x00000000bc4c0000)
>
> Code Cache  [0x0000000002730000, 0x00000000029a0000, 0x0000000005730000)
>  total_blobs=391 nmethods=67 adapters=277 free_code_cache=49629952
> largest_free_block=24512
>
> Dynamic libraries:
> 0x0000000000400000 - 0x000000000042e000 	C:\Program
> Files\Java\jre6\bin\javaw.exe
> 0x00000000772f0000 - 0x0000000077499000 	C:\Windows\SYSTEM32\ntdll.dll
> 0x00000000771d0000 - 0x00000000772ef000 	C:\Windows\system32\kernel32.dll
> 0x000007fefda70000 - 0x000007fefdadc000 	C:\Windows\system32\KERNELBASE.dll
> 0x000007feff0a0000 - 0x000007feff17b000 	C:\Windows\system32\ADVAPI32.dll
> 0x000007fefe190000 - 0x000007fefe22f000 	C:\Windows\system32\msvcrt.dll
> 0x000007feff4c0000 - 0x000007feff4df000 	C:\Windows\SYSTEM32\sechost.dll
> 0x000007fefde60000 - 0x000007fefdf8d000 	C:\Windows\system32\RPCRT4.dll
> 0x00000000770d0000 - 0x00000000771ca000 	C:\Windows\system32\USER32.dll
> 0x000007fefdbc0000 - 0x000007fefdc27000 	C:\Windows\system32\GDI32.dll
> 0x000007feff4e0000 - 0x000007feff4ee000 	C:\Windows\system32\LPK.dll
> 0x000007feff1d0000 - 0x000007feff299000 	C:\Windows\system32\USP10.dll
> 0x000007feff2a0000 - 0x000007feff2ce000 	C:\Windows\system32\IMM32.DLL
> 0x000007feff4f0000 - 0x000007feff5f9000 	C:\Windows\system32\MSCTF.dll
> 0x000000006fa00000 - 0x000000006fa3f000
> C:\PROGRA~2\Sophos\SOPHOS~1\SOPHOS~2.DLL
> 0x00000000774b0000 - 0x00000000774b7000 	C:\Windows\system32\PSAPI.DLL
> 0x000000006d7f0000 - 0x000000006dfa8000 	C:\Program
> Files\Java\jre6\bin\server\jvm.dll
> 0x000007fefc540000 - 0x000007fefc57b000 	C:\Windows\system32\WINMM.dll
> 0x000000006d760000 - 0x000000006d76e000 	C:\Program
> Files\Java\jre6\bin\verify.dll
> 0x000000006d3b0000 - 0x000000006d3d7000 	C:\Program
> Files\Java\jre6\bin\java.dll
> 0x000000006d7b0000 - 0x000000006d7c2000 	C:\Program
> Files\Java\jre6\bin\zip.dll
> 0x000007fef2590000 - 0x000007fef2673000
> D:\user\workspace\org.gdal\nativelib\win64\iconv.dll
> 0x000000006fd80000 - 0x000000006fe52000 	C:\Windows\system32\MSVCR100.dll
> 0x000007feebbc0000 - 0x000007feebd08000
> D:\user\workspace\org.gdal\nativelib\win64\libxml2.dll
> 0x000007fef9b10000 - 0x000007fef9b19000 	C:\Windows\system32\WSOCK32.dll
> 0x000007feff180000 - 0x000007feff1cd000 	C:\Windows\system32\WS2_32.dll
> 0x000007feff4b0000 - 0x000007feff4b8000 	C:\Windows\system32\NSI.dll
> 0x0000000068d60000 - 0x0000000068ec4000
> D:\user\workspace\org.gdal\nativelib\win64\pdflib.dll
> 0x000007feebb10000 - 0x000007feebbb3000
> D:\user\workspace\org.gdal\nativelib\win64\sqlite3.dll
> 0x000007fef4f40000 - 0x000007fef4f67000
> D:\user\workspace\org.gdal\nativelib\win64\openjpeg.dll
> 0x000007fefbe50000 - 0x000007fefbe66000
> D:\user\workspace\org.gdal\nativelib\win64\zlib1.dll
> 0x000007feeace0000 - 0x000007feeae67000
> D:\user\workspace\org.gdal\nativelib\win64\libeay32.dll
> 0x000007fef4840000 - 0x000007fef488e000
> D:\user\workspace\org.gdal\nativelib\win64\ssleay32.dll
> 0x000007fef4bc0000 - 0x000007fef4c08000
> D:\user\workspace\org.gdal\nativelib\win64\libcurl.dll
> 0x000007feea4b0000 - 0x000007feea66c000
> D:\user\workspace\org.gdal\nativelib\win64\geos_c.dll
> 0x000000006fea0000 - 0x000000006ff38000 	C:\Windows\system32\MSVCP100.dll
> 0x000007feea260000 - 0x000007feea4a1000
> D:\user\workspace\org.gdal\nativelib\win64\libmysql.dll
> 0x000007fef4810000 - 0x000007fef4835000
> D:\user\workspace\org.gdal\nativelib\win64\libpq.dll
> 0x000007fefb1e0000 - 0x000007fefb1e7000 	C:\Windows\system32\SHFOLDER.dll
> 0x000007fefe310000 - 0x000007feff098000 	C:\Windows\system32\SHELL32.dll
> 0x000007fefe030000 - 0x000007fefe0a1000 	C:\Windows\system32\SHLWAPI.dll
> 0x000007fefd5b0000 - 0x000007fefd5bb000 	C:\Windows\system32\Secur32.dll
> 0x000007fefd5e0000 - 0x000007fefd605000 	C:\Windows\system32\SSPICLI.DLL
> 0x0000000180000000 - 0x0000000180023000
> D:\user\workspace\org.gdal\nativelib\win64\libexpat.dll
> 0x000007fef3d40000 - 0x000007fef3d8e000
> D:\user\workspace\org.gdal\nativelib\win64\proj.dll
> 0x000007feeb850000 - 0x000007feeb971000
> D:\user\workspace\org.gdal\nativelib\win64\spatialite.dll
> 0x0000000012000000 - 0x000000001233a000
> D:\user\workspace\org.gdal\nativelib\win64\xerces-c_2_8.dll
> 0x000007fee8290000 - 0x000007fee8c13000
> D:\user\workspace\org.gdal\nativelib\win64\gdal18.dll
> 0x000007fef2680000 - 0x000007fef2731000 	C:\Windows\system32\ODBC32.dll
> 0x0000000070110000 - 0x0000000070148000 	C:\Windows\system32\odbcint.dll
> 0x000007fef5390000 - 0x000007fef53a3000
> D:\user\workspace\org.gdal\nativelib\win64\gdalconstjni.dll
> 0x000007fef43a0000 - 0x000007fef43f0000
> D:\user\workspace\org.gdal\nativelib\win64\gdaljni.dll
> 0x000007fef4370000 - 0x000007fef4392000
> D:\user\workspace\org.gdal\nativelib\win64\osrjni.dll
> 0x000007fef42c0000 - 0x000007fef42e5000
> D:\user\workspace\org.gdal\nativelib\win64\ogrjni.dll
> 0x000007fef77c0000 - 0x000007fef78e5000 	C:\Windows\system32\dbghelp.dll
>
> VM Arguments:
> jvm_args: -Dfile.encoding=UTF-8
> java_command: org.gdal.TestViolation
> Launcher Type: SUN_STANDARD
>
> Environment Variables:
> CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
> PATH=nativelib/win64
> USERNAME=user
> OS=Windows_NT
> PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 30 Stepping 5, GenuineIntel
>
>
>
> ---------------  S Y S T E M  ---------------
>
> OS: Windows 7 Build 7601 Service Pack 1
>
> CPU:total 8 (4 cores per cpu, 2 threads per core) family 6 model 30 stepping
> 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht
>
> Memory: 4k page, physical 4183896k(1680868k free), swap 8365944k(4551052k
> free)
>
> vm_info: Java HotSpot(TM) 64-Bit Server VM (20.0-b11) for windows-amd64 JRE
> (1.6.0_25-b06), built on Apr 14 2011 00:44:38 by "java_re" with MS VC++ 8.0
> (VS2005)
>
> time: Thu Jan 05 17:16:44 2012
> elapsed time: 24 seconds
>
>
>
>
>
> --
> View this message in context:
>
http://osgeo-org.1803224.n2.nabble.com/GDAL-Java-Binding-meomory-problem-under-intensive-method-calls-tp7155011p7155011.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list