Hi OFFIS team,
I tried to implement an on-the-fly thumbnail creation into StoreSCP.exe (3.5.3) which works fine except for the fact, that this gives a memory leak. Since I am not very familiar with C++, could you give me a hint were the leak might be produced?
I placed this code directyl after the storing of the Fileset to disc with SaveToFile.
Thanks in advance,
Regards,
Andreas
// now create thumbnail image
if ((*imageDataSet)->tagExistsWithValue(DCM_PixelData,OFFalse))
{
DicomImage *di = new DicomImage(cbdata->dcmff, xfer, CIF_MayDetachPixelData, 0, 1);
if ((di != NULL)&&(di->getStatus() == EIS_Normal))
{
di->setWindow(0);
const unsigned long lwidth = 200;
const unsigned long lheight = 0;
di = di->createScaledImage(lwidth, lheight, 1, 1);
di->writeBMP(bmpFilename.c_str(),24,0);
}
delete di;
}
//end creation of thumbnail image
Creating Bitmap Thumbnails with StoreSCP
Moderator: Moderator Team
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
The problem with your code is that you have two objects on the heap (one create by "new" and the other one create by "createScaledImage") but delete only one of them (i.e. the latter). I would suggest that you use another variable for the return value of "createScaledImage" and delete both DicomImage objects at the end of your code.
-
- Posts: 49
- Joined: Wed, 2005-02-16, 16:27
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest