Crash in "chooseRepresentation" method of "DcmDataset"?

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
faisal_tum
Posts: 33
Joined: Fri, 2013-01-11, 15:37

Crash in "chooseRepresentation" method of "DcmDataset"?

#1 Post by faisal_tum »

My program crashes in the following piece of code

Code: Select all

if(xfer == 12 || xfer == 11 || xfer == 24 || xfer == 19 || xfer == 20 || xfer == 21 || xfer == 22 || xfer == 23 || xfer == 25 || xfer == 26 || xfer == 30)
{
    DJ_RPLossless params;
    compressing = dataset->chooseRepresentation(xfer, &params);
    if(compressing != EC_Normal)
    {
        cout<<"Something wrong with compressing!\n";
    }
}
// Still compression methods 28, 29, 31, 32, 33 not covered. Potential bug exists.
else if(xfer == 4 || xfer == 5 || xfer == 6 || xfer == 7 || xfer == 8 || xfer == 9 || xfer == 10 || xfer == 13 || xfer == 14 || xfer == 15 || xfer == 16 || xfer == 17 || xfer == 18 || xfer == 27)
{
    DJ_RPLossy params;
    compressing = dataset->chooseRepresentation(xfer, &params);
    if(compressing != EC_Normal)
    {
        cout<<"Something wrong with compressing!\n";
    }
}
The crash doesn't always happen. It suddenly happens sometimes and is inconsistent.

An image of the stack is given to show which files might be related.
Image

Error pops in the
dicoptx.h
file in the following piece code at line 560
Image


FYI I'm making a GUI combining Qt and DCMTK. Almost everything is now fine except this occasional crash. Could you please give a hint what could be the problem? Thanks.

J. Riesmeier
DCMTK Developer
Posts: 2541
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Crash in "chooseRepresentation" method of "DcmDataset"?

#2 Post by J. Riesmeier »

Did you check whether the memory is exhausted? It seems that the call to "new T[Count]" failed and, therefore, throwed an exception that isn't caught...

J. Riesmeier
DCMTK Developer
Posts: 2541
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Crash in "chooseRepresentation" method of "DcmDataset"?

#3 Post by J. Riesmeier »

I just committed a patch that should make sure that in such a case (new[] fails), no exception is thrown.

faisal_tum
Posts: 33
Joined: Fri, 2013-01-11, 15:37

Re: Crash in "chooseRepresentation" method of "DcmDataset"?

#4 Post by faisal_tum »

J. Riesmeier wrote:I just committed a patch that should make sure that in such a case (new[] fails), no exception is thrown.
Thanks. Is there any trick or method to optimize when using DCMTK where I can lessen Memory Exhaustion?

J. Riesmeier
DCMTK Developer
Posts: 2541
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Crash in "chooseRepresentation" method of "DcmDataset"?

#5 Post by J. Riesmeier »

The answer depends on your use case, i.e. what you want to do. Using chooseRepresentation() compresses/decompresses the complete dataset, which might consume more main memory than your system has.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest