[osg-users] ref_ptr wrong utilisation ?

Paul Martz pmartz at skew-matrix.com
Fri Sep 19 07:43:03 PDT 2008


If TextureInit is, for example, a singleton that persists for the life of
the application, then it's destructor never gets called. However, it only
allocates once. If this is the case, then technically speaking it's not a
leak, at least not the kind of leak that would impact anyone's application.
 


  _____  

From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Vincent
Bourdier
Sent: Friday, September 19, 2008 8:35 AM
To: osg
Subject: [osg-users] ref_ptr wrong utilisation ?



Hi,

Looking for memory leaks, Visual Leak Detector return me that : 

---------- Block 0 at 0x01F12C18: 100 bytes ----------
  Call Stack:
    z:\projets\easymonitoring\3dem\trunk\include\terrain\textureinit.h (39):
TextureInit::TextureInit
    z:\projets\easymonitoring\3dem\trunk\src\terrain\terrain.cpp (21):
`dynamic initializer for 'textureInit''
    f:\sp\vctools\crt_bld\self_x86\crt\src\crt0dat.c (855): _initterm
    f:\sp\vctools\crt_bld\self_x86\crt\src\crtexe.c (512): __tmainCRTStartup
    f:\sp\vctools\crt_bld\self_x86\crt\src\crtexe.c (414): mainCRTStartup
    0x7C816FD7 (File and line number not available):
RegisterWaitForInputIdle
  Data:
[...]

with the following code : 

class TextureInit  {
    
 public:


     TextureInit( unsigned int numCol, unsigned int numRow ) 
    {

[...]


                _texCoord = new osg::Vec2Array( numCol * numRow ); //l 39.

[...]

    }

~TextureInit()
     {
        _texCoord = NULL;
     }


//get method returning ref_prt
[...]

protected:

    osg::ref_ptr<osg::Vec2Array>            _texCoord;
}


TextureInit  is declarer as a global delcaration... maybe this can be the
only problem..

Any idea ?

Thanks,
Regards,

Vincent.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080919/772b4eaf/attachment-0003.htm>


More information about the osg-users mailing list