[ITK] Memory leaks with ITK and MFC

Lee, Kyungmoo kyungmoo-lee at uiowa.edu
Thu Mar 10 00:18:42 EST 2016


Dear HTH, Matt, and all,

I created another MFC example using CMake. My source code is in http://user.engineering.uiowa.edu/~kyungmle/share/MFCITK-src.zip. In my MFC example, I added only 2 lines (#include "itkImage.h", #include "itkImageFileReader.h") to MFCITKView.cpp. Adding #include "itkImageFileReader.h" causes memory leaks like the screenshot in http://user.engineering.uiowa.edu/~kyungmle/share/Screenshot-MemoryLeaks.jpg. Do you know why? Please help me. Thank you.

Kit


From: Dženan Zukić [mailto:dzenanz at gmail.com]
Sent: Tuesday, March 08, 2016 5:06 PM
To: Lee, Kyungmoo <kyungmoo-lee at uiowa.edu<mailto:kyungmoo-lee at uiowa.edu>>
Cc: Matt McCormick <matt.mccormick at kitware.com<mailto:matt.mccormick at kitware.com>>; community at itk.org<mailto:community at itk.org>
Subject: Re: [ITK] Memory leaks with ITK and MFC

Hi Kit,

since you didn't use CMake to configure your project, you need to register IO factories<http://itk.org/ITKExamples/src/IO/ImageBase/RegisterIOFactories/Documentation.html> manually.

Add to the beginning of TestMFCITK2015View.cpp:
#include "itkMetaImageIOFactory.h"
and in void CTestMFCITK2015View::OnTestItk():
itk::MetaImageIOFactory::RegisterOneFactory(); //support .mha and .mhd

With these two changes in runs on my machine.

HTH

On Mon, Mar 7, 2016 at 10:34 AM, Lee, Kyungmoo <kyungmoo-lee at uiowa.edu<mailto:kyungmoo-lee at uiowa.edu>> wrote:
Dear Matt and all,

I made a simple MFC example to use ITK (http://user.engineering.uiowa.edu/~kyungmle/share/TestMFCITK2015.zip). I am using MS Windows 7, MS Visual C++ 2015, ITK-4.9.0, and CMake 3.4.3. When I click [Test]-[ITK] in the menu in Debug, x64 mode, the example clashes in itkImageFileReader.hxx. Can you check my source code? Thanks a lot!

Kit

From: Lee, Kyungmoo
Sent: Tuesday, March 01, 2016 4:24 PM
To: 'Matt McCormick' <matt.mccormick at kitware.com<mailto:matt.mccormick at kitware.com>>
Cc: community at itk.org<mailto:community at itk.org>
Subject: RE: [ITK] Memory leaks with ITK and MFC


Hi Matt,



Thank you for replying. I would like to use ITK in my MFC application. It has another memory-related problem in my application (See the following figure). I guess that there is a conflict between ITK smart pointer and MFC structure. If you fix InsightApplications-4.8.0/ItkMFC, it would be a good reference for my MFC programming. Thank you so much!!!



Kit



[cid:image001.png at 01D17A5A.0321D810]

-----Original Message-----
From: Matt McCormick [mailto:matt.mccormick at kitware.com]
Sent: Tuesday, March 01, 2016 4:04 PM
To: Lee, Kyungmoo <kyungmoo-lee at uiowa.edu<mailto:kyungmoo-lee at uiowa.edu>>
Cc: community at itk.org<mailto:community at itk.org>
Subject: Re: [ITK] Memory leaks with ITK and MFC



Hi Kit,



We are in the process of deprecating InsightApplications.



However, if you create an MFC application that uses ITK, there should be no issues or memory leaks.



HTH,

Matt



On Mon, Feb 29, 2016 at 3:32 PM, Lee, Kyungmoo <kyungmoo-lee at uiowa.edu<mailto:kyungmoo-lee at uiowa.edu>> wrote:

> Dear all,

>

>

>

> When I run InsightApplications-4.8.0/ItkMFC using ITK-4.8.2, MS

> Windows, and Visual Studio 2010/2012, I found memory leaks. Other

> persons in the following links have the same problem. I cannot find

> any solution on the web. Please help me. Thank you.

>

>

>

> https://cmake.org/pipermail/insight-users/2007-July/022885.html

>

> http://itk-insight-users.2283740.n2.nabble.com/No-one-knows-the-ITK-MF

> C-memory-leak-problem-td7583950.html

>

>

>

> Kit

>

>

>

>

> _______________________________________________

> Community mailing list

> Community at itk.org<mailto:Community at itk.org>

> http://public.kitware.com/mailman/listinfo/community

>

_______________________________________________
Community mailing list
Community at itk.org<mailto:Community at itk.org>
http://public.kitware.com/mailman/listinfo/community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20160310/2f319fb5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 150441 bytes
Desc: image001.png
URL: <http://public.kitware.com/pipermail/community/attachments/20160310/2f319fb5/attachment-0001.png>


More information about the Community mailing list