<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>

<META content="MSHTML 6.00.6000.16441" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=406241600-11052007>These 
are real memory leaks as can be seen by the CD value. This is put in by the MS 
CRT memory management when memory is allocated. FD is used in delete. You will 
need to turn DEBUG_LEAKS on in VTK to see if it VTK or your code that is 
leaking. That said I've been using VTK and MFC for a few years and ALL memory 
leaks have been my fault</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=406241600-11052007></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=406241600-11052007>Paul 
Tait</SPAN></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2><BR></FONT>&nbsp;</DIV>Hi All,<BR><BR>I have limited 
  experience with VTK, but from what I know about memory management, I should be 
  getting no memory leaks at all in my application at all.<BR>I have 2 DLL's, 
  one containing my main sound analysis program and another holding VTK code for 
  visualisation. <BR>Sound.dll loads Visualisation.dll via a call to 
  LoadLibrary("Vlisualisation.dll");<BR><BR>Inside Visualisation.dll, I have a 
  class "CVisualisationApp", which is instantiated by static functions in the 
  Visualisation.dll such as "CreateSystem(), DestroySystem() etc". These static 
  functions are called externally by Sound.dll. This CVisualisationApp class 
  holds all references to VTK objects and extends CWinApp - it also holds the 
  render function and handles all UI basically. There are no calls to VTK 
  elements outside of this class. <BR><BR>This CVisualisationApp class is 
  instantiated by one of the static functions {"CreateSystem()"} which just 
  does:<BR>theApp = new CVisualisationApp();<BR><BR>so basically, by 
  Visualisation.h looks something like this: <BR><BR 
style="COLOR: rgb(0,0,102)">
  <DIV style="MARGIN-LEFT: 40px"><FONT style="COLOR: rgb(0,0,102)" size=1>class 
  CVisualisationApp : public CWinApp</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>{</FONT><BR 
  style="COLOR: rgb(0,0,102)"><FONT style="COLOR: rgb(0,0,102)" 
  size=1>public:</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>&nbsp;&nbsp;&nbsp; 
  CVisualisationApp();</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>&nbsp;&nbsp;&nbsp; 
  ~CVisualisationApp();</FONT><BR style="COLOR: rgb(0,0,102)"><BR 
  style="COLOR: rgb(0,0,102)"><FONT style="COLOR: rgb(0,0,102)" 
  size=1>public:</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>&nbsp;&nbsp;&nbsp; virtual BOOL 
  InitInstance();</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1></FONT><FONT style="COLOR: rgb(0,0,102)" 
  size=1>&nbsp;&nbsp;&nbsp; BOOL Render(double dt); </FONT><BR 
  style="COLOR: rgb(0,0,102)"><FONT style="COLOR: rgb(0,0,102)" 
  size=1>&nbsp;&nbsp; //more functions and fun</FONT><BR 
  style="COLOR: rgb(0,0,102)"><FONT style="COLOR: rgb(0,0,102)" 
  size=1>}</FONT><BR></DIV><BR>and my Visualisation.cpp looks a bit like 
  this:<BR><BR style="COLOR: rgb(51,0,153)">
  <DIV style="MARGIN-LEFT: 40px"><FONT style="COLOR: rgb(0,0,102)" 
  size=1>CVisualisationApp *theApp = 0;</FONT><BR 
  style="COLOR: rgb(0,0,102)"><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>extern "C" __declspec( dllexport 
  )</FONT><BR style="COLOR: rgb(0,0,102)"><FONT style="COLOR: rgb(0,0,102)" 
  size=1>int __cdecl createSystem() { </FONT><BR 
  style="COLOR: rgb(0,0,102)"><FONT style="COLOR: rgb(0,0,102)" 
  size=1>&nbsp;&nbsp;&nbsp; </FONT><FONT style="COLOR: rgb(0,0,102)" size=1>if 
  (theApp != 0)</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  return 0;</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>&nbsp;&nbsp;&nbsp; theApp = new 
  CVisualisationApp();</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>&nbsp;&nbsp;&nbsp; 
  theApp-&gt;InitInstance();</FONT><BR style="COLOR: rgb(0,0,102)"><FONT 
  style="COLOR: rgb(0,0,102)" size=1>&nbsp;&nbsp;&nbsp; return 1;</FONT><BR 
  style="COLOR: rgb(0,0,102)"><FONT size=1><SPAN 
  style="COLOR: rgb(0,0,102)">}</SPAN><BR style="COLOR: rgb(0,0,102)"><BR 
  style="COLOR: rgb(0,0,102)"><SPAN 
  style="COLOR: rgb(0,0,102)">CVisualisationApp::CVisualisationApp()</SPAN><SPAN 
  style="COLOR: rgb(0,0,102)"></SPAN><BR style="COLOR: rgb(0,0,102)"><SPAN 
  style="COLOR: rgb(0,0,102)">{<BR>&nbsp;&nbsp; //Instantiation stuff<BR 
  style="COLOR: rgb(0,0,102)"></SPAN><SPAN 
  style="COLOR: rgb(0,0,102)">}<BR><BR></SPAN></FONT><FONT size=1><SPAN 
  style="COLOR: rgb(0,0,102)">CVisualisationApp::InitInstance() </SPAN><SPAN 
  style="COLOR: rgb(0,0,102)"></SPAN><BR style="COLOR: rgb(0,0,102)"><SPAN 
  style="COLOR: rgb(0,0,102)">{<BR>&nbsp;&nbsp; //Initialisation stuff<BR 
  style="COLOR: rgb(0,0,102)"></SPAN><SPAN 
  style="COLOR: rgb(0,0,102)">}</SPAN><BR></FONT><BR><FONT size=1><SPAN 
  style="COLOR: rgb(0,0,102)"></SPAN><BR></FONT></DIV><FONT size=2>Now my 
  problem is that even if I don't create the 'theApp' object (comment out the 
  body of the createSystem() function), I still get memory leaks from VTK. I 
  guess my question is, could VTK detect memory leaks from my main sound.dll app 
  (although I don't think there are any leaks there) - or, does vtk have some 
  static functions that could be causing memory leaks even though I don't create 
  any objects. The output dump looks something like this: </FONT><BR><BR><BR>
  <DIV style="MARGIN-LEFT: 40px"><FONT size=1>Detected memory 
  leaks!</FONT><BR><FONT size=1>Dumping objects -&gt;</FONT><BR><FONT 
  size=1>{32407} normal block at 0x0B70B070, 4 bytes long.</FONT><BR><FONT 
  size=1>&nbsp;Data: &lt;PWh &gt; 50 57 68 0B </FONT><BR><FONT size=1>{32406} 
  normal block at 0x0C996730, 8 bytes long.</FONT><BR><FONT size=1>&nbsp;Data: 
  &lt;@f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt; 40 66 99 0C 00 00 00 00 
  </FONT><BR><FONT size=1>{32405} normal block at 0x0C997A38, 21 bytes 
  long.</FONT><BR><FONT size=1>&nbsp;Data: &lt;System Shutting &gt; 53 79 73 74 
  65 6D 20 53 68 75 74 74 69 6E 67 20 </FONT><BR><FONT size=1>{32404} normal 
  block at 0x0C997980, 120 bytes long. </FONT><BR><FONT size=1>&nbsp;Data: &lt;\ 
  p&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp; &gt; 5C 9F 70 
  0A 01 00 00 00 00 CD CD CD 23 03 02 00 </FONT><BR><FONT size=1>{32368} normal 
  block at 0x0C9971D8, 168 bytes long.</FONT><BR><FONT size=1>&nbsp;Data: 
  &lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &gt; CC B9 8F 09 01 00 00 00 00 CD CD CD 17 03 02 00 </FONT><BR><FONT 
  size=1>{32367} normal block at 0x0C9970F0, 168 bytes long.</FONT><BR><FONT 
  size=1>&nbsp;Data: 
  &lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &gt; CC B9 8F 09 01 00 00 00 00 CD CD CD 15 03 02 00 </FONT><BR><FONT 
  size=1>{32366} normal block at 0x0C997008, 168 bytes long. </FONT><BR><FONT 
  size=1>&nbsp;Data: 
  &lt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  6&nbsp;&nbsp; &gt; CC B9 8F 09 02 00 00 00 00 CD CD CD 36 03 02 00 
  </FONT><BR><FONT size=1>{32365} normal block at 0x0C996640, 176 bytes 
  long.</FONT><BR><FONT size=1>&nbsp;Data: &lt; 
  2r&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (&nbsp;&nbsp; &gt; A4 32 72 
  0A 01 00 00 00 00 CD CD CD 28 03 02 00 </FONT><BR><FONT size=1>{32364} normal 
  block at 0x0C996588, 120 bytes long</FONT><BR><FONT size=1>{{{&nbsp; Pages and 
  pages more }}}</FONT><BR></DIV><BR><BR>Thanks in advance for any thoughts you 
  have - feel like my brain is melting on this one. If you need, I can provide a 
  list of libs and include files. <BR><BR>Marcus<BR></BLOCKQUOTE></BODY></HTML>