Invalid Memory Access with GLGraphics
in
Contributed Library Questions
•
2 years ago
Hi Andres, et al,
I have a sketch that is using GLGraphics as the renderer, with an OffScreenBuffer and a TextureWindow...
I have two erase functions
- void eraseBuffer() {
- color c = color(0,0);
- canvas.beginDraw();
- canvas.clear(0,0,0,0);
- canvas.endDraw();
- }
- //-----------------------------------------------------------------------------------------
- void eraseAll() {
- background(0); // reset background
- recorder.clear(); // clear gml
- numDrips = 0; // delete drips
- eraseBuffer(); // set buffer pixels to black
- }
One for the GLGraphicsBuffer, one for everything else... this works fine when called from a CP5 bang - i.e.
- void CLEAR(boolean theFlag) {
- if(theFlag == true) {
- println("ERASING");
- eraseAll();
- }
- }
but I also have an Android Remote Control sketch, where I use OSCP5..
- else if(msg.checkAddrPattern("/clearMSG") && msg.checkTypetag("i")) {
- println("Got Clear Msg");
- clearMSG = msg.get(0).intValue();
- if(clearMSG == 1) {
- eraseAll();
- clearMSG = 0;
- }
- }
but calling eraseAll() or erase() from here is crashing my sketch with an Invalid Memory Access error.
If I comment out the background(0) in the eraseAll() function and the entire eraseBuffer() function, it won't crash...
This is what's printing to the PDE console:
(sounds too much like C/C++ to me!)Invalid memory access of location 0x0 eip=0x93cac1d4
And this is the Crash Report:
Process: java [5017]
Path: /usr/bin/java
Identifier: com.apple.javajdk16.cmd
Version: 1.0 (1.0)
Code Type: X86 (Native)
Parent Process: JavaApplicationStub [1592]
PlugIn Path: /Applications/Processing/Processing.app/Contents/Resources/Java/modes/java/libraries/opengl/library/macosx/libjogl.jnilib
PlugIn Identifier: libjogl.jnilib
PlugIn Version: ??? (???)
Date/Time: 2011-09-27 15:24:46.359 +0200
OS Version: Mac OS X 10.6.8 (10K549)
Report Version: 6
Interval Since Last Report: 86284 sec
Crashes Since Last Report: 20
Per-App Interval Since Last Report: 23793 sec
Per-App Crashes Since Last Report: 19
Anonymous UUID: D433F9D2-DDA7-4959-B4F3-86BA02009942
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 27 Java: Thread-3
Application Specific Information:
Java information:
Exception type: Bus Error (0xa) at pc=0000000093cac1d4
Java VM: Java HotSpot(TM) Client VM (20.1-b02-384 mixed mode macosx-x86)
Current thread (000000004d862000): JavaThread "Thread-3" [_thread_in_native, id=-1315184640, stack(00000000b18be000,00000000b19be000)]
Stack: [00000000b18be000,00000000b19be000]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.sun.opengl.impl.GLImpl.glClearColor(FFFF)V+0
j processing.opengl.PGraphicsOpenGL.backgroundImpl()V+17
j processing.core.PGraphics.backgroundFromCalc()V+122
j processing.core.PGraphics.background(I)V+6
j bombIR.eraseAll()V+5
j bombIR.CLEAR(Z)V+11
j bombIR.oscEvent(LoscP5/OscMessage;)V+326
v ~StubRoutines::call_stub
j sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87
j sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6
j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+161
j oscP5.OscP5.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)V+3
j oscP5.OscP5.callMethod(LoscP5/OscMessage;)V+307
j oscP5.OscP5.process(Ljava/net/DatagramPacket;I)V+72
j oscP5.OscNetManager.process(Ljava/net/DatagramPacket;I)V+26
j netP5.AbstractUdpServer.run()V+96
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
Java Threads: ( => current thread )
000000004d868800 JavaThread "Poller SunPKCS11-Darwin" daemon [_thread_blocked, id=-1312014336, stack(00000000b1bc4000,00000000b1cc4000)]
000000000184f400 JavaThread "Image Fetcher 1" daemon [_thread_blocked, id=-1313071104, stack(00000000b1ac2000,00000000b1bc2000)]
000000000184ec00 JavaThread "Thread-4" [_thread_blocked, id=-1314127872, stack(00000000b19c0000,00000000b1ac0000)]
=>000000004d862000 JavaThread "Thread-3" [_thread_in_native, id=-1315184640, stack(00000000b18be000,00000000b19be000)]
0000000001801000 JavaThread "DestroyJavaVM" [_thread_blocked, id=-1341124608, stack(00000000b0001000,00000000b0101000)]
0000000002038000 JavaThread "Animation Thread" [_thread_blocked, id=-1316241408, stack(00000000b17bc000,00000000b18bc000)]
0000000002035800 JavaThread "Image Fetcher 0" daemon [_thread_blocked, id=-1317298176, stack(00000000b16ba000,00000000b17ba000)]
0000000006133000 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=-1318354944, stack(00000000b15b8000,00000000b16b8000)]
0000000002049400 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=-1319411712, stack(00000000b14b6000,00000000b15b6000)]
0000000001832c00 JavaThread "AWT-Shutdown" [_thread_blocked, id=-1321037824, stack(00000000b1329000,00000000b1429000)]
0000000001832400 JavaThread "AWT-AppKit" daemon [_thread_in_native, id=-1610267328, stack(00000000bf800000,00000000c0000000)]
0000000001819800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=-1323151360, stack(00000000b1125000,00000000b1225000)]
0000000002005c00 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=-1324208128, stack(00000000b1023000,00000000b1123000)]
0000000001813c00 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=-1325264896, stack(00000000b0f21000,00000000b1021000)]
0000000002004c00 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=-1326321664, stack(00000000b0e1f000,00000000b0f1f000)]
0000000002003c00 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=-1327378432, stack(00000000b0d1d000,00000000b0e1d000)]
000000004d805400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=-1328435200, stack(00000000b0c1b000,00000000b0d1b000)]
000000004d804400 JavaThread "Surrogate Locker Thread (Concurrent GC)" daemon [_thread_blocked, id=-1329491968, stack(00000000b0b19000,00000000b0c19000)]
000000000180bc00 JavaThread "Finalizer" daemon [_thread_blocked, id=-1331613696, stack(00000000b0913000,00000000b0a13000)]
000000000180ac00 JavaThread "Reference Handler" daemon [_thread_blocked, id=-1332670464, stack(00000000b0811000,00000000b0911000)]
Other Threads:
0000000001808400 VMThread [stack: 00000000b070f000,00000000b080f000] [id=-1333727232]
000000000181b000 WatcherThread [stack: 00000000b1227000,00000000b1327000] [id=-1322094592]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
par new generation total 14784K, used 2275K [0000000006800000, 0000000007800000, 000000000a800000)
eden space 13184K, 6% used [0000000006800000, 00000000068e4960, 00000000074e0000)
from space 1600K, 85% used [0000000007670000, 00000000077c42a8, 0000000007800000)
to space 1600K, 0% used [00000000074e0000, 00000000074e0000, 0000000007670000)
concurrent mark-sweep generation total 49152K, used 5181K [000000000a800000, 000000000d800000, 0000000046800000)
concurrent-mark-sweep perm gen total 12288K, used 11706K [0000000046800000, 0000000047400000, 000000004a800000)
Code Cache [0000000003801000, 0000000003912000, 0000000005801000)
total_blobs=705 nmethods=331 adapters=318 free_code_cache=32483712 largest_free_block=11776
Virtual Machine Arguments:
JVM Args: -Xrunjdwp:transport=dt_socket,address=127.0.0.1:8331,suspend=y -Xms64m -Xmx1024m -Djava.library.path=/Users/jessescott/Documents/Processing/CODE/GRL/bombIR/code:/Users/jessescott/Documents/Processing/libraries/controlP5/library:/Users/jessescott/Documents/Processing/libraries/oscP5/library:/Applications/Processing/Processing.app/Contents/Resources/Java/modes/java/libraries/opengl/library/macosx:/Users/jessescott/Documents/Processing/libraries/GLGraphics/library:/Users/jessescott/Documents/Processing/libraries/GML4U/library:/Applications/Processing/Processing.app/Contents/Resources/Java:/System/Library/PrivateFrameworks/JavaApplicationLauncher.framework/Resources:.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java -ea
Java Command: processing.core.PApplet --location=65,35 --external --display=1 --sketch-path=/Users/jessescott/Documents/Processing/CODE/GRL/bombIR bombIR
Launcher Type: SUN_STANDARD
Physical Memory: Page Size = 4k, Total = 3968M, Free = 1571M
....
1