app crash while scaling QImage
-
wrote on 14 Apr 2023, 10:36 last edited by
My app crashes. While
QImage newImg = img.scaled(qSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)
I get:# A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffff6957c28, pid=6200, tid=0x0000000000000058 # # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10) # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [Qt5Guid.dll+0x77c28] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\eclipse-rcp-2020-06-R-win32-x86_64\eclipse\hs_err_pid6200.log Compiled method (c1) 34920 4229 3 jogamp.opengl.gl4.GL4bcImpl::glGetIntegerv (125 bytes) total in heap [0x000002542973a2d0,0x000002542973d450] = 12672 relocation [0x000002542973a3f0,0x000002542973a620] = 560 main code [0x000002542973a620,0x000002542973c0c0] = 6816 stub code [0x000002542973c0c0,0x000002542973c250] = 400 oops [0x000002542973c250,0x000002542973c278] = 40 metadata [0x000002542973c278,0x000002542973c308] = 144 scopes data [0x000002542973c308,0x000002542973cfb0] = 3240 scopes pcs [0x000002542973cfb0,0x000002542973d3d0] = 1056 dependencies [0x000002542973d3d0,0x000002542973d3f8] = 40 nul chk table [0x000002542973d3f8,0x000002542973d450] = 88
while
QImage newImg = img.copy(0, 0, 100, 100)
I get:# A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffe0ed61657, pid=20448, tid=0x0000000000002d60 # # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10) # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [VCRUNTIME140D.dll+0x1657] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\eclipse-rcp-2020-06-R-win32-x86_64\eclipse\hs_err_pid20448.log Compiled method (c1) 28336 4193 3 jogamp.opengl.gl4.GL4bcImpl::glGetIntegerv (125 bytes) total in heap [0x0000023cbc5138d0,0x0000023cbc516a50] = 12672 relocation [0x0000023cbc5139f0,0x0000023cbc513c20] = 560 main code [0x0000023cbc513c20,0x0000023cbc5156c0] = 6816 stub code [0x0000023cbc5156c0,0x0000023cbc515850] = 400 oops [0x0000023cbc515850,0x0000023cbc515878] = 40 metadata [0x0000023cbc515878,0x0000023cbc515908] = 144 scopes data [0x0000023cbc515908,0x0000023cbc5165b0] = 3240 scopes pcs [0x0000023cbc5165b0,0x0000023cbc5169d0] = 1056 dependencies [0x0000023cbc5169d0,0x0000023cbc5169f8] = 40 nul chk table [0x0000023cbc5169f8,0x0000023cbc516a50] = 88
More info here.
Any idea, what could be wrong, please?
I do use Qt 5.12.0, system info:--------------- S Y S T E M --------------- OS: Windows 10.0 , 64 bit Build 19041 (10.0.19041.2546) CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 94 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx Memory: 4k page, physical 16694920k(10934708k free), swap 23510664k(11805564k free) vm_info: OpenJDK 64-Bit Server VM (25.222-b10) for windows-amd64 JRE (1.8.0_222-1-ojdkbuild-b10), built on Jul 18 2019 16:58:32 by "VssAdministrator" with MS VC++ 10.0 (VS2010)
-
My app crashes. While
QImage newImg = img.scaled(qSize, Qt::KeepAspectRatio, Qt::SmoothTransformation)
I get:# A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffff6957c28, pid=6200, tid=0x0000000000000058 # # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10) # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [Qt5Guid.dll+0x77c28] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\eclipse-rcp-2020-06-R-win32-x86_64\eclipse\hs_err_pid6200.log Compiled method (c1) 34920 4229 3 jogamp.opengl.gl4.GL4bcImpl::glGetIntegerv (125 bytes) total in heap [0x000002542973a2d0,0x000002542973d450] = 12672 relocation [0x000002542973a3f0,0x000002542973a620] = 560 main code [0x000002542973a620,0x000002542973c0c0] = 6816 stub code [0x000002542973c0c0,0x000002542973c250] = 400 oops [0x000002542973c250,0x000002542973c278] = 40 metadata [0x000002542973c278,0x000002542973c308] = 144 scopes data [0x000002542973c308,0x000002542973cfb0] = 3240 scopes pcs [0x000002542973cfb0,0x000002542973d3d0] = 1056 dependencies [0x000002542973d3d0,0x000002542973d3f8] = 40 nul chk table [0x000002542973d3f8,0x000002542973d450] = 88
while
QImage newImg = img.copy(0, 0, 100, 100)
I get:# A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffe0ed61657, pid=20448, tid=0x0000000000002d60 # # JRE version: OpenJDK Runtime Environment (8.0_222-b10) (build 1.8.0_222-b10) # Java VM: OpenJDK 64-Bit Server VM (25.222-b10 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [VCRUNTIME140D.dll+0x1657] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\eclipse-rcp-2020-06-R-win32-x86_64\eclipse\hs_err_pid20448.log Compiled method (c1) 28336 4193 3 jogamp.opengl.gl4.GL4bcImpl::glGetIntegerv (125 bytes) total in heap [0x0000023cbc5138d0,0x0000023cbc516a50] = 12672 relocation [0x0000023cbc5139f0,0x0000023cbc513c20] = 560 main code [0x0000023cbc513c20,0x0000023cbc5156c0] = 6816 stub code [0x0000023cbc5156c0,0x0000023cbc515850] = 400 oops [0x0000023cbc515850,0x0000023cbc515878] = 40 metadata [0x0000023cbc515878,0x0000023cbc515908] = 144 scopes data [0x0000023cbc515908,0x0000023cbc5165b0] = 3240 scopes pcs [0x0000023cbc5165b0,0x0000023cbc5169d0] = 1056 dependencies [0x0000023cbc5169d0,0x0000023cbc5169f8] = 40 nul chk table [0x0000023cbc5169f8,0x0000023cbc516a50] = 88
More info here.
Any idea, what could be wrong, please?
I do use Qt 5.12.0, system info:--------------- S Y S T E M --------------- OS: Windows 10.0 , 64 bit Build 19041 (10.0.19041.2546) CPU:total 8 (initial active 8) (4 cores per cpu, 2 threads per core) family 6 model 94 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, ht, tsc, tscinvbit, bmi1, bmi2, adx Memory: 4k page, physical 16694920k(10934708k free), swap 23510664k(11805564k free) vm_info: OpenJDK 64-Bit Server VM (25.222-b10) for windows-amd64 JRE (1.8.0_222-1-ojdkbuild-b10), built on Jul 18 2019 16:58:32 by "VssAdministrator" with MS VC++ 10.0 (VS2010)
Hi and welcome to devnet,
Are you using a 32bit build of Qt ?
Are you tied to 5.12.0 ? Can you at least test with a more recent version ? -
Hi and welcome to devnet,
Are you using a 32bit build of Qt ?
Are you tied to 5.12.0 ? Can you at least test with a more recent version ?wrote on 15 Apr 2023, 17:36 last edited by@SGaist Thanks for comment! I do use 64bit version. I tried 5.12.0 and 5.12.12. I can check if there is some newer version to use, because I use VS2015 to build and debug my app. There might be problem with memory, tiff file allocates 4.2GB. Windows photos or paint can not display it as well. Gimp can do it, it needs over 6GB of RAM. I never tried to open such big tiff before this one.
-
@SGaist Thanks for comment! I do use 64bit version. I tried 5.12.0 and 5.12.12. I can check if there is some newer version to use, because I use VS2015 to build and debug my app. There might be problem with memory, tiff file allocates 4.2GB. Windows photos or paint can not display it as well. Gimp can do it, it needs over 6GB of RAM. I never tried to open such big tiff before this one.
What kind of Tiff file is that ?
Do you really need to load it fully in memory ? -
wrote on 15 Apr 2023, 19:25 last edited by know
@SGaist it is a technical drawing. It is saved as RGBA8888, therefore needs so much memory. I need as good quality of image as it get. Maybe I could create
QImage::Format_Mono
, but would be great to display any tiff anyway. But strange is that app crashes even when trying to display small piece:QImage newImg = img.copy(0, 0, 100, 100)
.
Some real data:i_Width:81118 i_Height:13244 l_originRowBytes:324472 l_rowBytes:324472 l_originSize:2339872 QImage::Format_RGBA8888 qSize:4297307168 // after memory allocation
-
@SGaist it is a technical drawing. It is saved as RGBA8888, therefore needs so much memory. I need as good quality of image as it get. Maybe I could create
QImage::Format_Mono
, but would be great to display any tiff anyway. But strange is that app crashes even when trying to display small piece:QImage newImg = img.copy(0, 0, 100, 100)
.
Some real data:i_Width:81118 i_Height:13244 l_originRowBytes:324472 l_rowBytes:324472 l_originSize:2339872 QImage::Format_RGBA8888 qSize:4297307168 // after memory allocation
If only Gimp is able to load that file it likely uses something smart to load such a file. I currently don't think the Tiff image loader from Qt is that subtle.
-
If only Gimp is able to load that file it likely uses something smart to load such a file. I currently don't think the Tiff image loader from Qt is that subtle.
wrote on 18 Apr 2023, 11:11 last edited by@SGaist maybe I've found the problem: I use
void myImageObj::addData(unsigned char *i_pData, unsigned int i_bytesPerRow, unsigned int i_width, unsigned int i_height, float i_scaleX, float i_scaleY, unsigned short int i_spp, unsigned short int i_bps, int i_layertype, int i_PosX, int i_PosY) { if(i_layertype == BACKGROUND) m_data = QVector<unsigned char>(i_bytesPerRow*i_height); else m_data = QVector<unsigned char>(i_bytesPerRow); m_bytesPerRow = i_bytesPerRow; m_width = i_width; m_height = i_height; m_scaleX = i_scaleX; m_scaleY = i_scaleY; m_spp = i_spp; m_bps = i_bps; m_layertype = (LAYERTYPE)i_layertype; m_PosX = i_PosX; m_PosY = i_PosY; int mds = m_data.size(); std::copy(i_pData, i_pData + m_data.size(), stdext::checked_array_iterator<unsigned char*>( m_data.data(), m_data.size())); }
and then
m_data.size() = 2,339,872
although I allocated 4,297,307,168. I miss exactly 2^32. I probably need something else thenQVector
. -
@SGaist maybe I've found the problem: I use
void myImageObj::addData(unsigned char *i_pData, unsigned int i_bytesPerRow, unsigned int i_width, unsigned int i_height, float i_scaleX, float i_scaleY, unsigned short int i_spp, unsigned short int i_bps, int i_layertype, int i_PosX, int i_PosY) { if(i_layertype == BACKGROUND) m_data = QVector<unsigned char>(i_bytesPerRow*i_height); else m_data = QVector<unsigned char>(i_bytesPerRow); m_bytesPerRow = i_bytesPerRow; m_width = i_width; m_height = i_height; m_scaleX = i_scaleX; m_scaleY = i_scaleY; m_spp = i_spp; m_bps = i_bps; m_layertype = (LAYERTYPE)i_layertype; m_PosX = i_PosX; m_PosY = i_PosY; int mds = m_data.size(); std::copy(i_pData, i_pData + m_data.size(), stdext::checked_array_iterator<unsigned char*>( m_data.data(), m_data.size())); }
and then
m_data.size() = 2,339,872
although I allocated 4,297,307,168. I miss exactly 2^32. I probably need something else thenQVector
.Qt 5's QVector uses an int for its size so you have hit its limit.
1/8