Dirk Reiners wrote:
> So far I haven't found any real memory leaks. I define those as things 
> that keep growing as the app runs, e.g. you keep displaying and changing 
> things and memory keeps on growing. I haven't seen any of those in a while.

Hi,

recently I wrote about a memory leak which appeared after an
update to the current CVS version of OpenSG. The memory leak
is related to osg::Geometry and thread aspects.

Nobody answered, though. Everybody was busy at that time because
of the Siggraph, I assume. :)

Thus, I take the opportunity to mention it again. Quote:

> [...] observed a memleak related to OpenSG
> threads aspects. (topic was "memleak, thread sync")
> 
> I found out that this memleak is caused by a change
> of osg::Geometry, where some cleanup-code was moved
> from the destructor to Geometry::onDestroy(). The
> CVS log entry is:
> 
> Revision : 1.30
> Date : 2006/1/8 14:20:38
> Author : 'a-m-z'
> State : 'Exp'
> Lines : +35 -27
> Description :
> moved destructor code into onDestroy this fixed some strange gl object 
> create/destroy cycle (with the same id)
> 
> I fixed the memory leak by calling onDestroy() for
> every thread aspect in FieldContainerPtrBase::deleteContainers().
> See code at the end on the email.
> 
> Any comments on that?
> 
> Best regards,
> 
> C. Moritz Goellner
> 
> 
> 
> inline
> void FieldContainerPtrBase::deleteContainers(void) const
> {
> //    dump(0, FCDumpFlags::RefCount);
> 
>     Thread::getCurrentChangeList()->addDestroyed(*getIdP());
> 
>     if (FieldContainerFactory::the()->unregisterFieldContainer(
>             *((const FieldContainerPtr *) this)))
>     {
>         return;
>     }
> 
>     UInt8 *pTmp = getFirstElemP();
> 
>     // --cmg previous: ((FieldContainer *) pTmp)->onDestroy();
> 
>     // --cmg new: call onDestroy for every aspect
>     UInt8 *pTmp_aspect = pTmp;
> 
>     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
>     {
>     ((FieldContainer *) pTmp_aspect)->onDestroy();
>     pTmp_aspect += _containerSize;
>     }
> 
> #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM)
> 
>     fprintf(stderr, "GV_MEM_FC_DBG : (%u) d (%p|%u)\n",
>             Thread::getAspect(),
>             pTmp,
> //            ((FieldContainer *) pTmp)->getType().getCName(),
>             ((FieldContainer *) pTmp)->getType().getId());
> #endif
> 
> #if defined(OSG_FIXED_MFIELDSYNC)
>     ((FieldContainer *) pTmp)->~FieldContainer();
> #endif
> 
>     for(UInt32 i = 0; i < ThreadManager::getNumAspects(); i++)
>     {
> #if defined(OSG_FIXED_MFIELDSYNC)
>         ((FieldContainer *) pTmp)->onDestroyAspect(*(getIdP()), i);
> #endif
> 
> #if !defined(OSG_FIXED_MFIELDSYNC)
>         ((FieldContainer *) pTmp)->~FieldContainer();
> #endif
> 
>         pTmp += _containerSize;
>     }
> 
>     operator delete(_storeP + getRefCountOff());
> }

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to