[vtkusers] Resource Leak with VTK + BCB6 (vtkTimerLog)

Xianjin Yang Yang at AGIUSA.COM
Tue Aug 12 10:29:36 EDT 2003


Here is the relevant VTK source code the "Leak" error message points to

// Allocate timing table with MaxEntries elements.
void vtkTimerLog::AllocateLog()
{
  if (vtkTimerLog::TimerLog != NULL)
    {
    delete [] vtkTimerLog::TimerLog;
    }
  vtkTimerLog::TimerLog = new vtkTimerLogEntry[vtkTimerLog::MaxEntries];   <====
This Line
}


void vtkTimerLog::MarkStartEvent(const char *event)
{
  if (! vtkTimerLog::Logging)
    { // Maybe we should still change the Indent ...
    return;
    }

  vtkTimerLog::MarkEvent(event);   <======= This Line
  ++vtkTimerLog::Indent;
}

void vtkOpenGLPolyDataMapper::RenderPiece(vtkRenderer *ren, vtkActor *act)
{
    ...

    if (!this->ImmediateModeRendering && 
        !this->GetGlobalImmediateModeRendering())
      {
      vtkTimerLog::MarkStartEvent("Building display list");   <==== This Line
      this->ReleaseGraphicsResources(ren->GetRenderWindow());
      this->LastWindow = ren->GetRenderWindow();
   ...

}

-----Original Message-----
From: Mathieu Malaterre [mailto:Mathieu.Malaterre at creatis.insa-lyon.fr] 
Sent: Tuesday, August 12, 2003 4:18 AM
To: John Biddiscombe
Cc: Xianjin Yang; vtkusers at vtk.org
Subject: Re: [vtkusers] Resource Leak with VTK + BCB6


Same problem on linux:

http://public.kitware.com/pipermail/vtkusers/2003-April/017674.html

mathieu

John Biddiscombe wrote:
> It looks like there's a leak in the timer log code. Presumably when 
> the
> program exits, something should be destroying the timerlog but isn't. 
> Have you tried tracking down any references to cleaning up the timer log 
> on exit?
>  
> JB
>  
> 
>     -----Original Message-----
>     *From:* Xianjin Yang [mailto:Yang at AGIUSA.COM]
>     *Sent:* 11 August 2003 22:17
>     *To:* vtkusers at vtk.org
>     *Subject:* [vtkusers] Resource Leak with VTK + BCB6
> 
>     Hi vtkusers,
> 
>     I am using VTK 4.2 with Borland C++ Builder 6 on WinXP, and get this
>     "Resource Leak" error frequently (see attachment). I have never used
>     vtkTimerLog, vtkOpenGLPolyDataMapper and vtkOpenGLActor explicitly
>     in my code. Is there anything I can do to fix this? Thanks. Yang
> 
>     <<MemLeak.jpg>>
> 


-- 
Mathieu Malaterre
CREATIS
28 Avenue du Doyen LEPINE
B.P. Lyon-Montchat
69394 Lyon Cedex 03
http://www.creatis.insa-lyon.fr/~malaterre/



More information about the vtkusers mailing list