Memory Leak

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
CHANDRAB
Posts: 1
Joined: Fri, 2006-03-17, 15:41

Memory Leak

#1 Post by CHANDRAB »

Hi,

I have created a Win32 console application with MFC support with
the following VC++ 6.0 setting:
1. Using MFC in a shared DLL

The follownig example code for making a Dicom file in the documentation/help is leaking memory when used with the Boundschecker.

_______________________________________________
char uid[100];
DcmFileFormat fileformat;
DcmDataset *dataset = fileformat.getDataset();
dataset->putAndInsertString(DCM_SOPClassUID, UID_SecondaryCaptureImageStorage);
dataset->putAndInsertString(DCM_SOPInstanceUID, dcmGenerateUniqueIdentifier(uid, SITE_INSTANCE_UID_ROOT));
dataset->putAndInsertString(DCM_PatientsName, "Doe^John");
OFCondition status = fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit);
if (status.bad())
cerr << "Error: cannot write DICOM file (" << status.text() << ")" << endl;
__________________________________________________________

The error message is :
Memory allocation conflict
Allocated by malloc
Freed by operator delete
________________________________________________________

The occurs at the OFCondition status = fileformat.saveFile("test.dcm", EXS_LittleEndianExplicit); line.

Can anybody help me?

Thanks,
Chandra

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

I checked the code of dcmdata but could not find any memory block that is allocated by malloc and freed by delete. Do you have any news on this issue?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest