Qt-jambi-interest Archive, April 2007
JVM crash when loading a (quite) big image
Message 1 in thread
Hi,
Using the ImageViewer demo, trying to load a 20000x20000 PNG image (256 colours) makes the JVM crash. However loading a 10000x10000 image of the same format works fine.
[As a side note, the following code also makes the JVM crash with a big image, but the error seems different :
import com.trolltech.qt.gui.*;
public class TooBigImage {
public static void main(String[] args) {
QApplication.initialize(args);
QPixmap smallPixmap = new QPixmap("small.png"); // 10000x10000x8 image; OK
System.out.println("successful small pixmap creation");
QPixmap bigPixmap = new QPixmap("big.png"); // 20000x20000x8 image; JVM crashes here
System.out.println("successful big pixmap creation");
}
}
]
Btw, thanks for the good work on QTJambi and for all the new and improved features in Qt !
Best Regards,
Marc Madaule
The JVM error log from ImageViewer:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x65063ab9, pid=9288, tid=8732
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode)
# Problematic frame:
# C [QtGui4.dll+0x63ab9]
#
--------------- T H R E A D ---------------
Current thread (0x0b3420b0): JavaThread "Thread-2" daemon [_thread_in_native, id=8732]
siginfo: ExceptionCode=0xc0000005, reading address 0x00000050
Registers:
EAX=0x0bd7e670, EBX=0x65064980, ECX=0x00000050, EDX=0x0bd4d7b8
ESP=0x0ceef8a4, EBP=0x0ceefaac, ESI=0x00000050, EDI=0x00000004
EIP=0x65063ab9, EFLAGS=0x00010206
Top of Stack: (sp=0x0ceef8a4)
0x0ceef8a4: 0bda8fd0 650699a8 0bd4d7b8 00000003
0x0ceef8b4: 0bda8fd0 00000001 00000000 6538af8c
0x0ceef8c4: 40400000 00000000 40400000 00000000
0x0ceef8d4: 00000000 00000000 00000000 00000000
0x0ceef8e4: 0ceef938 65350ff8 00000000 6506bcc5
0x0ceef8f4: 0ceef92c 00000af0 00000000 0ceefaac
0x0ceef904: 0bda8fd0 0716fe01 00000000 0ceef8fc
0x0ceef914: 6538af8c 00000000 0bd4d768 b8d1b717
Instructions: (pc=0x65063ab9)
0x65063aa9: c2 04 00 cc cc cc cc 8b 44 24 04 8b 00 56 8b f1
0x65063ab9: 39 06 74 31 8d 48 34 ba 01 00 00 00 f0 0f c1 11
Stack: [0x0cdf0000,0x0cef0000), sp=0x0ceef8a4, free space=1022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [QtGui4.dll+0x63ab9]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.trolltech.qt.gui.QImage.__qt_scaled_QSize_AspectRatioMode_TransformationMode(JJII)Lcom/trolltech/qt/gui/QImage;+0
j com.trolltech.qt.gui.QImage.scaled(Lcom/trolltech/qt/core/QSize;Lcom/trolltech/qt/core/Qt$AspectRatioMode;Lcom/trolltech/qt/core/Qt$TransformationMode;)Lcom/trolltech/qt/gui/QImage;+52
j com.trolltech.demos.imageviewer.LazyPixmap.loadThumbNail()V+69
j com.trolltech.demos.imageviewer.ImageTableModel$1.run()V+13
j java.lang.Thread.run()V+11
j com.trolltech.qt.QThread.run()V+8
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
=>0x0b3420b0 JavaThread "Thread-2" daemon [_thread_in_native, id=8732]
0x0b2cc980 JavaThread "Thread-0" daemon [_thread_blocked, id=9008]
0x00b5e0f8 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=5160]
0x00b5cd80 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4528]
0x00b5c0a0 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=3656]
0x00b52f80 JavaThread "Finalizer" daemon [_thread_in_vm, id=3188]
0x00b51b08 JavaThread "Reference Handler" daemon [_thread_blocked, id=8128]
0x003e5658 JavaThread "main" [_thread_in_native, id=3364]
Other Threads:
0x00b4d8b8 VMThread [id=8016]
0x00b5f488 WatcherThread [id=9244]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 9K [0x02ba0000, 0x02c40000, 0x03080000)
eden space 512K, 1% used [0x02ba0000, 0x02ba27a8, 0x02c20000)
from space 64K, 0% used [0x02c20000, 0x02c20000, 0x02c30000)
to space 64K, 0% used [0x02c30000, 0x02c30000, 0x02c40000)
tenured generation total 1616K, used 872K [0x03080000, 0x03214000, 0x06ba0000)
the space 1616K, 53% used [0x03080000, 0x0315a0a0, 0x0315a200, 0x03214000)
compacting perm gen total 8192K, used 6454K [0x06ba0000, 0x073a0000, 0x0aba0000)
the space 8192K, 78% used [0x06ba0000, 0x071ed9e0, 0x071eda00, 0x073a0000)
No shared spaces configured.
Dynamic libraries:
0x00400000 - 0x00429000 C:\dev\qtjambi-win-1.0.0-beta\qtjambi.exe
0x7c800000 - 0x7c8c0000 C:\WINDOWS\system32\ntdll.dll
0x77e40000 - 0x77f42000 C:\WINDOWS\system32\kernel32.dll
0x77380000 - 0x77412000 C:\WINDOWS\system32\USER32.dll
0x77c00000 - 0x77c48000 C:\WINDOWS\system32\GDI32.dll
0x77f50000 - 0x77fec000 C:\WINDOWS\system32\ADVAPI32.dll
0x77c50000 - 0x77cef000 C:\WINDOWS\system32\RPCRT4.dll
0x76290000 - 0x762ad000 C:\WINDOWS\system32\IMM32.DLL
0x62d80000 - 0x62d89000 C:\WINDOWS\system32\LPK.DLL
0x75490000 - 0x754f1000 C:\WINDOWS\system32\USP10.dll
0x77ba0000 - 0x77bfa000 C:\WINDOWS\system32\msvcrt.dll
0x10000000 - 0x10023000 C:\dev\qtjambi-win-1.0.0-beta\bin\QtJambi.dll
0x67000000 - 0x67167000 C:\dev\qtjambi-win-1.0.0-beta\bin\QtCore4.dll
0x77670000 - 0x777a4000 C:\WINDOWS\system32\ole32.dll
0x71c00000 - 0x71c17000 C:\WINDOWS\system32\WS2_32.dll
0x71bf0000 - 0x71bf8000 C:\WINDOWS\system32\WS2HELP.dll
0x7c3a0000 - 0x7c41b000 C:\WINDOWS\system32\MSVCP71.dll
0x7c340000 - 0x7c396000 C:\WINDOWS\system32\MSVCR71.dll
0x6d640000 - 0x6d7dd000 C:\Program Files\Java\jre1.5.0_11\bin\client\jvm.dll
0x76aa0000 - 0x76acd000 C:\WINDOWS\system32\WINMM.dll
0x6d290000 - 0x6d298000 C:\Program Files\Java\jre1.5.0_11\bin\hpi.dll
0x76b70000 - 0x76b7b000 C:\WINDOWS\system32\PSAPI.DLL
0x6d610000 - 0x6d61c000 C:\Program Files\Java\jre1.5.0_11\bin\verify.dll
0x6d310000 - 0x6d32d000 C:\Program Files\Java\jre1.5.0_11\bin\java.dll
0x6d630000 - 0x6d63f000 C:\Program Files\Java\jre1.5.0_11\bin\zip.dll
0x65000000 - 0x65551000 C:\dev\qtjambi-win-1.0.0-beta\bin\QtGui4.dll
0x762b0000 - 0x762fa000 C:\WINDOWS\system32\comdlg32.dll
0x77530000 - 0x775c7000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.2778_x-ww_497C098C\COMCTL32.dll
0x7c8d0000 - 0x7d0d4000 C:\WINDOWS\system32\SHELL32.dll
0x77da0000 - 0x77df2000 C:\WINDOWS\system32\SHLWAPI.dll
0x77d00000 - 0x77d8c000 C:\WINDOWS\system32\OLEAUT32.dll
0x73070000 - 0x73097000 C:\WINDOWS\system32\WINSPOOL.DRV
0x77420000 - 0x77523000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.3790.2778_x-ww_A8F04F11\comctl32.dll
0x0b5c0000 - 0x0b63d000 C:\dev\qtjambi-win-1.0.0-beta\bin\com_trolltech_qt_core.dll
0x0b840000 - 0x0bb5c000 C:\dev\qtjambi-win-1.0.0-beta\bin\com_trolltech_qt_gui.dll
0x0bb60000 - 0x0bba5000 C:\Program Files\sys\Radeon Omega Drivers\v3.8.291\ATI Tray Tools\raphook.dll
0x73ac0000 - 0x73ad8000 C:\WINDOWS\system32\AVIFIL32.dll
0x77b70000 - 0x77b84000 C:\WINDOWS\system32\MSACM32.dll
0x75fc0000 - 0x75fe2000 C:\WINDOWS\system32\MSVFW32.dll
0x4b8d0000 - 0x4b921000 C:\WINDOWS\system32\MSCTF.dll
0x71b70000 - 0x71ba6000 C:\WINDOWS\system32\uxtheme.dll
0x75e60000 - 0x75e87000 C:\WINDOWS\system32\apphelp.dll
0x4dc30000 - 0x4dc5e000 C:\WINDOWS\system32\msctfime.ime
0x62000000 - 0x6202a000 C:\dev\qtjambi-win-1.0.0-beta\bin\QtSql4.dll
0x0bc20000 - 0x0bc4a000 C:\dev\qtjambi-win-1.0.0-beta\bin\com_trolltech_qt_sql.dll
0x0bc50000 - 0x0bc97000 C:\dev\qtjambi-win-1.0.0-beta\plugins\sqldrivers\qsqlite.dll
0x64000000 - 0x64049000 C:\dev\qtjambi-win-1.0.0-beta\bin\QtNetwork4.dll
0x0beb0000 - 0x0bed6000 C:\dev\qtjambi-win-1.0.0-beta\bin\com_trolltech_qt_network.dll
0x77b90000 - 0x77b98000 C:\WINDOWS\system32\version.dll
0x76f50000 - 0x76f63000 C:\WINDOWS\system32\secur32.dll
0x76920000 - 0x769e4000 C:\WINDOWS\system32\userenv.dll
0x61000000 - 0x61033000 C:\dev\qtjambi-win-1.0.0-beta\bin\QtXml4.dll
0x66000000 - 0x66038000 C:\dev\qtjambi-win-1.0.0-beta\bin\QtSvg4.dll
0x0bee0000 - 0x0bef9000 C:\dev\qtjambi-win-1.0.0-beta\bin\com_trolltech_qt_svg.dll
0x63000000 - 0x6302f000 C:\dev\qtjambi-win-1.0.0-beta\bin\QtOpenGL4.dll
0x5e8d0000 - 0x5e99e000 C:\WINDOWS\system32\OPENGL32.dll
0x68720000 - 0x68740000 C:\WINDOWS\system32\GLU32.dll
0x73860000 - 0x738ac000 C:\WINDOWS\system32\DDRAW.dll
0x73b30000 - 0x73b36000 C:\WINDOWS\system32\DCIMAN32.dll
0x0c2f0000 - 0x0c306000 C:\dev\qtjambi-win-1.0.0-beta\bin\com_trolltech_qt_opengl.dll
0x0c310000 - 0x0c318000 C:\dev\qtjambi-win-1.0.0-beta\plugins\iconengines\qsvg1.dll
0x0c320000 - 0x0c329000 C:\dev\qtjambi-win-1.0.0-beta\plugins\imageformats\qgif1.dll
0x0c330000 - 0x0c350000 C:\dev\qtjambi-win-1.0.0-beta\plugins\imageformats\qjpeg1.dll
0x0c350000 - 0x0c388000 C:\dev\qtjambi-win-1.0.0-beta\plugins\imageformats\qmng1.dll
0x770e0000 - 0x771ea000 C:\WINDOWS\system32\SETUPAPI.dll
0x777b0000 - 0x77834000 C:\WINDOWS\system32\CLBCatQ.DLL
0x77010000 - 0x770d6000 C:\WINDOWS\system32\COMRes.dll
0x77b00000 - 0x77b54000 C:\WINDOWS\System32\cscui.dll
0x76520000 - 0x7653e000 C:\WINDOWS\System32\CSCDLL.dll
0x768f0000 - 0x76915000 C:\WINDOWS\system32\ntshrui.dll
0x71c40000 - 0x71c98000 C:\WINDOWS\system32\NETAPI32.dll
VM Arguments:
jvm_args: -Djava.library.path=.\bin;c:\program files\apps\imagemagick-6.3.1-q16;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
java_command: <unknown>
Launcher Type: generic
Environment Variables:
PATH=.\bin;c:\program files\apps\imagemagick-6.3.1-q16;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
USERNAME=oki132
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel
--------------- S Y S T E M ---------------
OS: Windows Server 2003 family Build 3790 Service Pack 1
CPU:total 2 (cores per cpu 2, threads per core 1) family 6 model 15 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2
Memory: 4k page, physical 1046916k(383824k free), swap 2531776k(1418804k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_11-b03) for windows-x86, built on Dec 15 2006 01:16:12 by "java_re" with MS VC++ 6.0
Créez votre adresse électronique prenom.nom@xxxxxxxxxxx
1 Go d'espace de stockage, anti-spam et anti-virus intégrés.
Message 2 in thread
marc.madaule wrote:
> Hi,
>
> Using the ImageViewer demo, trying to load a 20000x20000 PNG image (256
> colours) makes the JVM crash. However loading a 10000x10000 image of the
> same format works fine.
Hi Marc,
This is a known limitation. In general we recommend that you do not
create QPixmaps that are significantly bigger than your screen, as the
windowing system often does not handle it. What happens in the above
case is that we first create a QImage of 400Mb which is non-problematic
on most machines. We then convert the QImage to a QPixmap. On X11 a
pixmap cannot be bigger than 16x16 due to limitations in the X server.
On windows the QImage is converted to a 32-bit chunk of data, hence
increasing the memory to 1.6 Gb. This didn't crash on my machine but it
did start to swap rather dramatically ;-)
The reason it crashed for you is most likely that you ran out of memory
/ swap space and that we in Qt assumed a valid address where we instead
got a null pointer because of the failed memory allocation. I went
through the QImage code and added sanity checks to several places where
we make these assumptions, so in the future it should not crash, but you
should get a QImage back that reports true on isNull().
Thanks for reporting,
Gunnar