[prev in list] [next in list] [prev in thread] [next in thread] 

List:       vtkusers
Subject:    Re: [vtkusers] Vtk nightlies and Win2000 -- Unloading the DLLs
From:       JJ_Tian () moldflow ! com
Date:       2000-08-28 14:00:04
Message-ID: OFCC8FB5C0.02DF6CF5-ON85256949.004C6FB1 () moldflow ! com
[Download RAW message or body]

     Several weeks ago I reported a memory leak which may be related to
what you found.

     The memory of vtkObjectFactory::RegisterdFactories is allocated in
vtkObjectFactory::Init(); but it is never released because the
UnRegisterAllFactories function is not called automatically. This causes a
mem leak of 40 bytes (not 4MB).
     I added the following in my code and solved the problem. There may be
better ways to do the same.
class COFMgr
{
public:
     COFMgr()
     {
//        vtkObjectFactory::Init();//it must be called by the first ::New()
function
     };
     ~COFMgr()
     {
          vtkObjectFactory::UnRegisterAllFactories();
     }
};
static COFMgr ofMgr;





                                                                                      \
                
                    Nigel Nunn                                                        \
                
                    <nNunn@ausport.gov.au>         To:     \
                vtkusers@public.kitware.com                                       
                    Sent by:                       cc:                                \
                
                    vtkusers-admin@public.k        Subject:     [vtkusers] Vtk \
                nightlies and Win2000 -- Unloading the DLLs   
                    itware.com                                                        \
                
                                                                                      \
                
                                                                                      \
                
                    08/27/00 12:48 PM                                                 \
                
                                                                                      \
                
                                                                                      \




I recently noticed that exiting a Vtk application does not
appear to release the 40 MB of memory that seems to be used
by the set of DLLs we build from the nightly vtk source.

This initial loss of RAM only happens once, so I assume the
DLLs are remaining loaded after a Vtk-enabled program exits.

Of more concern is that we loose a further 4MB after starting
and stopping any application that calls the Vtk libraries.
This applies to TCL demos, the basic MFC Win32 Sample, as well
as our own MFC-based application.  This means that after running
our application ten times, or even 10 TCL examples, we have lost
40 + (10*4) = 80 MB of RAM.  Only way to recover seems to be
rebooting.  Logging off then on does not recover this memory.
I cannot recall if this also happened under WinNT 4.0.

What sort of implicit linking does PCMAKER set up for the
Win32 DLLs?  Does this need different treatment under Win2000?
We are using Windows 2000 and Vtk nightlies from May and
August on Pentium II & III multiprocessor boxes.

Thanks,
Nigel


_______________________________________________
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://public.kitware.com/mailman/listinfo/vtkusers


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic