Hello Guest

[CLOSED] Backward compatibility to undirect buffers

  • 3 Replies
[CLOSED] Backward compatibility to undirect buffers
« on: March 29, 2011, 22:42:15 »
HI !
I''ve been debugging my app for a whole night : I had to sort out why my AWTGLCanvas rendering loop crashed over and over after a few minutes of runtime. "Outofmemory Error : ChunkPool::allocate 32634b , not enough swap space?" it said. So I found out what was in duty : to get back to undirect buffers.
 I had changed my BufferIO init settings to allocateDirect() for 2.3 LWJGL compatibility. That was not big to deal with, replace LWJGL 2.3 with 2.2.2 release and -voilà-, everything ran ok !

ByteBuffer.AllocateDirect() requires a amazing exactitude in how much PermGenMemory you need. This is not a big deal with finite number of textures. But if you want to load up more textures, keep a cache or anything "dynamically" (like a phototheque, sound plugins, etc.),its worth Hours to mesure for a Java Just- in-Time Dev I am ! 8)

JVM crash report on LWJGL 2.3 :
Code: [Select]
# A fatal error has been detected by the Java Runtime Environment:
# java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate. Out of swap space?
#  Internal Error (allocation.cpp:166), pid=5020, tid=1712
#  Error: ChunkPool::allocate
# JRE version: 6.0_24-b07
# Java VM: Java HotSpot(TM) Client VM (19.1-b02 mixed mode windows-x86 )
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp

---------------  T H R E A D  ---------------

Current thread (0x3e719000):  JavaThread "CompilerThread0" daemon [_thread_in_native, id=1712, stack(0x3f270000,0x3f2c0000)]

Stack: [0x3f270000,0x3f2c0000],  sp=0x3f2bf528,  free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x1fa487]
V  [jvm.dll+0xa340c]
V  [jvm.dll+0x2a09]
V  [jvm.dll+0x2c02]
V  [jvm.dll+0x2e03]
V  [jvm.dll+0x23194]
V  [jvm.dll+0x313bf]
V  [jvm.dll+0x32b01]
V  [jvm.dll+0x32ca3]
V  [jvm.dll+0x340ae]
V  [jvm.dll+0x3419e]
V  [jvm.dll+0x266b3]
V  [jvm.dll+0x26cbd]
V  [jvm.dll+0x26dcc]
V  [jvm.dll+0x26f23]
V  [jvm.dll+0x270f4]
V  [jvm.dll+0x869ec]
V  [jvm.dll+0x874e5]
V  [jvm.dll+0x1e4624]
V  [jvm.dll+0x18317c]
C  [msvcr71.dll+0x9565]
C  [kernel32.dll+0x44911]
C  [ntdll.dll+0x3e4b6]
C  [ntdll.dll+0x3e489]

Current CompileTask:
C1: 17% !   sun.java2d.d3d.D3DScreenUpdateManager.run()V @ 105 (268 bytes)

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x3fb84400 JavaThread "Timer-screen" [_thread_blocked, id=5400, stack(0x49dc0000,0x49fc0000)]
  0x3fb82c00 JavaThread "TWKS-Console input-DT" [_thread_blocked, id=5620, stack(0x49bc0000,0x49dc0000)]
  0x3fb82400 JavaThread "TWKS-GameActionLayer-DT" [_thread_blocked, id=3288, stack(0x465f0000,0x467f0000)]
  0x3fb83800 JavaThread "T-PrintStream-10177712333080" daemon [_thread_blocked, id=3152, stack(0x463f0000,0x465f0000)]
  0x3fb83c00 JavaThread "TWKS-Console input-DT" [_thread_blocked, id=5212, stack(0x458d0000,0x45ad0000)]
  0x3fb83000 JavaThread "TWKS-Console input-DT" [_thread_blocked, id=5980, stack(0x461f0000,0x463f0000)]
  0x3fb82000 JavaThread "Swing-Shell" daemon [_thread_blocked, id=4716, stack(0x44ad0000,0x44cd0000)]
  0x3fb81800 JavaThread "TWKS-ImageCollection -1025208032-DT" [_thread_blocked, id=220, stack(0x43e70000,0x44070000)]
  0x3fb81400 JavaThread "TWKS-imagebrowser-works-DT" [_thread_blocked, id=2480, stack(0x444d0000,0x446d0000)]
  0x3fa9d800 JavaThread "D3D Screen Updater" daemon [_thread_blocked, id=2492, stack(0x43970000,0x43b70000)]
  0x3fa5a800 JavaThread "TimerQueue" daemon [_thread_blocked, id=3320, stack(0x43c70000,0x43e70000)]
  0x3fa5a000 JavaThread "T-PrintStream-10146989125840" daemon [_thread_blocked, id=1904, stack(0x43770000,0x43970000)]
  0x3fa5b400 JavaThread "TWKS-Console input-DT" [_thread_blocked, id=2360, stack(0x43570000,0x43770000)]
  0x3fa6d000 JavaThread "TWKS-JXA_Security-DT" [_thread_blocked, id=2964, stack(0x43370000,0x43570000)]
  0x003cac00 JavaThread "DestroyJavaVM" [_thread_blocked, id=5660, stack(0x01ff0000,0x021f0000)]
  0x3fa55400 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=1608, stack(0x40b90000,0x40d90000)]
  0x3fa55000 JavaThread "AWT-Windows" daemon [_thread_in_native, id=5488, stack(0x40990000,0x40b90000)]
  0x3fa31800 JavaThread "AWT-Shutdown" [_thread_blocked, id=5452, stack(0x40790000,0x40990000)]
  0x3fa31000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=5124, stack(0x40590000,0x40790000)]
  0x3fa28400 JavaThread "RMI TCP Accept-0" daemon [_thread_in_native, id=300, stack(0x401b0000,0x403b0000)]
  0x3e71d400 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5832, stack(0x3f2c0000,0x3f4c0000)]
=>0x3e719000 JavaThread "CompilerThread0" daemon [_thread_in_native, id=1712, stack(0x3f270000,0x3f2c0000)]
  0x3e718800 JavaThread "Attach Listener" daemon [_thread_blocked, id=1936, stack(0x3f070000,0x3f270000)]
  0x3e718400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5352, stack(0x3ee70000,0x3f070000)]
  0x3e715c00 JavaThread "Surrogate Locker Thread (CMS)" daemon [_thread_blocked, id=5652, stack(0x3ec70000,0x3ee70000)]
  0x3e6e7400 JavaThread "Finalizer" daemon [_thread_blocked, id=4116, stack(0x3ea70000,0x3ec70000)]
  0x3e6e3000 JavaThread "Reference Handler" daemon [_thread_blocked, id=2500, stack(0x3e870000,0x3ea70000)]

Other Threads:
  0x3e6e0400 VMThread [stack: 0x3e820000,0x3e870000] [id=6056]
  0x3e800800 WatcherThread [stack: 0x3f510000,0x3f560000] [id=5180]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

 par new generation   total 59008K, used 26604K [0x041f0000, 0x081f0000, 0x081f0000)
  eden space 52480K,  38% used [0x041f0000, 0x0558b080, 0x07530000)
  from space 6528K, 100% used [0x07b90000, 0x081f0000, 0x081f0000)
  to   space 6528K,   0% used [0x07530000, 0x07530000, 0x07b90000)
 concurrent mark-sweep generation total 548864K, used 152750K [0x081f0000, 0x299f0000, 0x299f0000)
 concurrent-mark-sweep perm gen total 39288K, used 23525K [0x299f0000, 0x2c04e000, 0x3c5f0000)

Dynamic libraries:
0x00400000 - 0x00424000 C:\Program Files\Java\jre6\bin\javaw.exe
0x77a10000 - 0x77b37000 C:\Windows\system32\ntdll.dll
0x778a0000 - 0x7797b000 C:\Windows\system32\kernel32.dll
0x76520000 - 0x765e6000 C:\Windows\system32\ADVAPI32.dll
0x76320000 - 0x763e3000 C:\Windows\system32\RPCRT4.dll
0x77500000 - 0x7759d000 C:\Windows\system32\USER32.dll
0x77460000 - 0x774ab000 C:\Windows\system32\GDI32.dll
0x775e0000 - 0x775fe000 C:\Windows\system32\IMM32.DLL
0x77240000 - 0x77308000 C:\Windows\system32\MSCTF.dll
0x765f0000 - 0x7669a000 C:\Windows\system32\msvcrt.dll
0x77700000 - 0x77709000 C:\Windows\system32\LPK.DLL
0x771b0000 - 0x7722d000 C:\Windows\system32\USP10.dll
0x7c340000 - 0x7c396000 C:\Program Files\Java\jre6\bin\msvcr71.dll
0x6d7f0000 - 0x6da96000 C:\Program Files\Java\jre6\bin\client\jvm.dll
0x74990000 - 0x749c2000 C:\Windows\system32\WINMM.dll
0x77310000 - 0x77454000 C:\Windows\system32\ole32.dll
0x76290000 - 0x7631d000 C:\Windows\system32\OLEAUT32.dll
0x74430000 - 0x74469000 C:\Windows\system32\OLEACC.dll
0x760c0000 - 0x760ec000 C:\Windows\system32\apphelp.dll
0x6d7a0000 - 0x6d7ac000 C:\Program Files\Java\jre6\bin\verify.dll
0x6d320000 - 0x6d33f000 C:\Program Files\Java\jre6\bin\java.dll
0x6d280000 - 0x6d288000 C:\Program Files\Java\jre6\bin\hpi.dll
0x76280000 - 0x76287000 C:\Windows\system32\PSAPI.DLL
0x6d7e0000 - 0x6d7ef000 C:\Program Files\Java\jre6\bin\zip.dll
0x6d600000 - 0x6d613000 C:\Program Files\Java\jre6\bin\net.dll
0x77600000 - 0x7762d000 C:\Windows\system32\WS2_32.dll
0x77230000 - 0x77236000 C:\Windows\system32\NSI.dll
0x3f4c0000 - 0x3f502000 C:\Program Files\NVIDIA Corporation\NetworkAccessManager\bin32\nvLsp.dll
0x75920000 - 0x7595b000 C:\Windows\system32\mswsock.dll
0x75900000 - 0x75905000 C:\Windows\System32\wship6.dll
0x755a0000 - 0x755a5000 C:\Windows\System32\wshtcpip.dll
0x74400000 - 0x7440f000 C:\Windows\system32\NLAapi.dll
0x75b60000 - 0x75b79000 C:\Windows\system32\IPHLPAPI.DLL
0x75a80000 - 0x75ab5000 C:\Windows\system32\dhcpcsvc.DLL
0x75d70000 - 0x75d9c000 C:\Windows\system32\DNSAPI.dll
0x76120000 - 0x76134000 C:\Windows\system32\Secur32.dll
0x75b50000 - 0x75b57000 C:\Windows\system32\WINNSI.DLL
0x75ad0000 - 0x75af1000 C:\Windows\system32\dhcpcsvc6.DLL
0x721a0000 - 0x721af000 C:\Windows\system32\napinsp.dll
0x71f00000 - 0x71f12000 C:\Windows\system32\pnrpnsp.dll
0x72190000 - 0x72198000 C:\Windows\System32\winrnr.dll
0x774b0000 - 0x774fa000 C:\Windows\system32\WLDAP32.dll
0x72690000 - 0x72696000 C:\Windows\system32\rasadhlp.dll
0x6d550000 - 0x6d559000 C:\Program Files\Java\jre6\bin\management.dll
0x75660000 - 0x7569b000 C:\Windows\system32\rsaenh.dll
0x76140000 - 0x7615e000 C:\Windows\system32\USERENV.dll
0x6d000000 - 0x6d14a000 C:\Program Files\Java\jre6\bin\awt.dll
0x72a30000 - 0x72a72000 C:\Windows\system32\WINSPOOL.DRV
0x75220000 - 0x753be000 C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6001.18000_none_5cdbaa5a083979cc\COMCTL32.dll
0x77c10000 - 0x77c68000 C:\Windows\system32\SHLWAPI.dll
0x74110000 - 0x7411c000 C:\Windows\system32\DWMAPI.DLL
0x74f30000 - 0x74f6f000 C:\Windows\system32\uxtheme.dll
0x6d230000 - 0x6d27f000 C:\Program Files\Java\jre6\bin\fontmanager.dll
0x71650000 - 0x7180a000 C:\Windows\system32\d3d9.dll
0x75910000 - 0x75918000 C:\Windows\system32\VERSION.dll
0x71ef0000 - 0x71ef6000 C:\Windows\system32\d3d8thk.dll
0x70ef0000 - 0x71646000 C:\Windows\system32\nvd3dum.dll
0x755c0000 - 0x755da000 C:\Windows\system32\powrprof.dll
0x77710000 - 0x7789a000 C:\Windows\system32\SETUPAPI.dll
0x766a0000 - 0x771af000 C:\Windows\system32\SHELL32.dll
0x42590000 - 0x4269a000 C:\Windows\system32\nvapi.dll
0x75410000 - 0x7543d000 C:\Windows\system32\WINTRUST.dll
0x75bd0000 - 0x75cc1000 C:\Windows\system32\CRYPT32.dll
0x75d30000 - 0x75d42000 C:\Windows\system32\MSASN1.dll
0x775b0000 - 0x775d9000 C:\Windows\system32\imagehlp.dll
0x6d620000 - 0x6d629000 C:\Program Files\Java\jre6\bin\nio.dll
0x6d560000 - 0x6d5f3000 C:\Program Files\Java\jre6\bin\mlib_image.dll
0x6d1a0000 - 0x6d1c3000 C:\Program Files\Java\jre6\bin\dcpr.dll
0x3f680000 - 0x3f68b000 C:\Users\Tiana\clib_jiio_util.dll
0x44370000 - 0x4447c000 C:\Users\Tiana\clib_jiio_sse2.dll
0x40510000 - 0x4054f000 C:\Users\Tiana\lwjgl.dll
0x6ba50000 - 0x6bb1b000 C:\Windows\system32\OPENGL32.dll
0x72e70000 - 0x72e93000 C:\Windows\system32\GLU32.dll
0x6a510000 - 0x6a5f5000 C:\Windows\system32\DDRAW.dll
0x74a70000 - 0x74a76000 C:\Windows\system32\DCIMAN32.dll
0x6d350000 - 0x6d356000 C:\Program Files\Java\jre6\bin\jawt.dll
0x77b90000 - 0x77c03000 C:\Windows\system32\COMDLG32.DLL
0x6b990000 - 0x6ba4a000 C:\Windows\system32\spool\DRIVERS\W32X86\3\unidrvui.dll
0x6a450000 - 0x6a510000 C:\Windows\system32\spool\DRIVERS\W32X86\3\mxdwdrv.dll
0x72e50000 - 0x72e66000 C:\Windows\system32\FontSub.dll
0x77980000 - 0x77a04000 C:\Windows\system32\CLBCatQ.DLL
0x6a780000 - 0x6a9a3000 C:\Windows\system32\NetworkExplorer.dll
0x742f0000 - 0x743aa000 C:\Windows\system32\PROPSYS.dll
0x70d60000 - 0x70e67000 C:\Windows\System32\shdocvw.dll
0x75cd0000 - 0x75ce4000 C:\Windows\system32\MPR.dll
0x6ed10000 - 0x6ed23000 C:\Windows\System32\ntlanman.dll
0x75f80000 - 0x75ff5000 C:\Windows\System32\NETAPI32.dll
0x6f7a0000 - 0x6f7a8000 C:\Windows\System32\drprov.dll
0x6ed40000 - 0x6ed4f000 C:\Windows\System32\davclnt.dll
0x704f0000 - 0x704fb000 C:\Windows\system32\cscapi.dll
0x6a1e0000 - 0x6a44e000 C:\Windows\system32\wpdshext.dll
0x747d0000 - 0x7497b000 C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6001.18000_none_9e752e5ac9c619f3\gdiplus.dll
0x72610000 - 0x72656000 C:\Windows\system32\PortableDeviceApi.dll
0x708c0000 - 0x708eb000 C:\Windows\system32\PortableDeviceTypes.dll
0x6f040000 - 0x6f07f000 C:\Windows\system32\audiodev.dll
0x70920000 - 0x70b6b000 C:\Windows\system32\WMVCore.DLL
0x70eb0000 - 0x70ee9000 C:\Windows\system32\WMASF.DLL
0x706a0000 - 0x706a9000 C:\Windows\system32\LINKINFO.dll
0x697b0000 - 0x698d9000 C:\Users\Tiana\OpenAL32.dll
0x6fc00000 - 0x6fc70000 C:\Windows\system32\dsound.dll
0x75170000 - 0x75197000 C:\Windows\System32\MMDevApi.dll
0x742c0000 - 0x742ef000 C:\Windows\system32\wdmaud.drv
0x74980000 - 0x74984000 C:\Windows\system32\ksuser.dll
0x755b0000 - 0x755b7000 C:\Windows\system32\AVRT.dll
0x74290000 - 0x742b1000 C:\Windows\system32\AUDIOSES.DLL
0x74160000 - 0x741c6000 C:\Windows\system32\audioeng.dll
0x743f0000 - 0x743f9000 C:\Windows\system32\msacm32.drv
0x740a0000 - 0x740b4000 C:\Windows\system32\MSACM32.dll
0x74090000 - 0x74097000 C:\Windows\system32\midimap.dll
0x49fc0000 - 0x4aa34000 C:\Windows\system32\nvoglv32.dll

VM Arguments:
jvm_args: -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true -Xss2m -XX:PermSize=32m -XX:MaxPermSize=300m -Xms64M -Xmx600M -Dcom.sun.media.imageio.disableCodecLib=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote -Djava.security.policy=JavaSecurityPolicy -Dsun.java2d.d3d=True -Dsun.java2d.noddraw=true -Dsun.java2d.translaccel=false
java_command: net.sf.jiga.xtended.ui.JFCFrame -antframe jxa.IMCBrowser -width 800 -height 600 -demo
Launcher Type: SUN_STANDARD

Environment Variables:
PROCESSOR_IDENTIFIER=x86 Family 6 Model 28 Stepping 2, GenuineIntel

---------------  S Y S T E M  ---------------

OS: Windows Vista Build 6001 Service Pack 1

CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 28 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, ht

Memory: 4k page, physical 3406340k(581012k free), swap 7059372k(3865784k free)

vm_info: Java HotSpot(TM) Client VM (19.1-b02) for windows-x86 JRE (1.6.0_24-b07), built on Feb  2 2011 17:44:41 by "java_re" with MS VC++ 7.1 (VS2003)

time: Tue Mar 29 02:44:37 2011
elapsed time: 154 seconds

I'm for a backward compatibility to undirect buffers in LWJGL GL and AL calls. Java developers who want dynamic just in time computing and resources usage are also. 
« Last Edit: April 09, 2011, 11:11:25 by broumbroum »

Re: [RFE] Backward compatibility to undirect buffers
« Reply #1 on: March 29, 2011, 22:49:20 »
For any more support , here's my code for BufferIO, and you can check "_findvacantbuffer(capacity)", though it's not up to date (april-11 revision would be the modified 2.2.2 LWJGL compatible one). That method checks for re-usable Byte-Int-Double-Float-Shortbuffers.
Whenever the app (I made) needs a Buffer (GL color, GL gen, AL sound..), it runs BufferIO. So the perm gen may not be estimated before. And therefore allocateDirect() is not usable (http://sf3jswing.hg.sourceforge.net/hgweb/sf3jswing/sf3jswing/file/6b338a55c9db/sf3jswing-jigaxtended/src/all/net/sf/jiga/xtended/impl/system/BufferIO.java#l327).
« Last Edit: March 29, 2011, 22:52:21 by broumbroum »


Offline kappa

  • *****
  • 1316
Re: [RFE] Backward compatibility to undirect buffers
« Reply #2 on: June 23, 2011, 11:36:20 »
LWJGL no longer supports indirect buffers, don't think they'll be added again, so if you need to use them you'll just have need to get along with the older version of LWJGL.

Re: [CLOSED] Backward compatibility to undirect buffers
« Reply #3 on: June 23, 2011, 18:30:28 »
OK,I've found a way to make input of direct buffers when needed by LWJGL func's.