[vtkusers] Resource Leak with VTK + BCB6

John Biddiscombe john.biddiscombe at mirada-solutions.com
Tue Aug 12 12:53:15 EDT 2003


I sympathise with your frustration, but as a volunteer who has a full time job to do...it's not easy to answer or read every single email on the list. Most of us just dip in from time to time when we have a spare moment and help out. I suggest you email kitware directly and request cvs write access. 

I'm not sure if the best way to solve the problem is delete the memory in the destructor as you posted (not setting the pointer to null though which will cause AV's later), or delete on program termination. I suspect that if multiple threads are using the memory, dire problems may result.

CC'ing to developers.

JB


> -----Original Message-----
> From: N Smethurst [mailto:nick.smethurst at free.fr]
> Sent: 12 August 2003 17:28
> To: vtkusers at vtk.org
> Subject: Re: [vtkusers] Resource Leak with VTK + BCB6
> 
> 
> I suggested this code in April. Is it really surprising that 
> many people 
> cannot be bothered to report bugs anymore if our emails are ignored??
> 
> Le Mardi 12 Août 2003 12:32, John Biddiscombe a écrit :
> > Hmmm....I see.
> >
> > Looking at vtkTimerLog.cxx and .h I see that AllocateLog 
> allocates some
> > memory but there's no cleanup in the destructor - as it's a static
> > structure it may be reused at different time. I think it'd 
> be best to
> > add a static cleanup method in there that can be called just before
> > program exit by the user.
> >
> > try this
> >
> > add to vtkTimerLog.h
> >
> > static void DeallocateLog();
> >
> >
> > add to vtkTimerLog.cxx
> >
> > void DeallocateLog()
> > {
> >   if (vtkTimerLog::TimerLog != NULL)
> >     {
> >     delete [] vtkTimerLog::TimerLog;
> >     }
> >   vtkTimerLog::TimerLog = NULL;
> > }
> >
> > and at some point when your program is about to exit and no more vtk
> > objects are going to be used, do a 
> vtkTimerLog::DeallocateLog(); call.
> > This will free up the memory. Is this only used when some 
> debugging is
> > enabled, or is it always used?
> >
> > If this fix cures the problem, then I guess it can be 
> added, but there
> > ought to be some invisible timerlog management that does this
> > automatically...
> >
> > JB
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> > <http://public.kitware.com/cgi-bin/vtkfaq> Follow this link to
> > subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: 
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 



More information about the vtkusers mailing list