|
From: Michael L. <in...@pa...> - 2003-06-19 04:57:41
|
Please assist in explaining this output. It regards a class varaiable=20
declared
=09static MyApp*=09_ptr;
and defined with
=09MyApp* MyApp::_ptr;
It is being initialized and released with:
=09static MyApp& GetRef()
=09{=09
=09=09if( 0 =3D=3D _ptr )
=09=09=09_ptr =3D new MyApp;
=09=09return *_ptr;
=09}
=09static void shutdown()
=09{=20
=09=09delete _ptr;=20
=09=09_ptr =3D 0;
=09}
valgrind output:
=3D=3D10037=3D=3D Invalid write of size 4
=3D=3D10037=3D=3D at 0x408F3E14: _GLOBAL__I__ZN12MyApp4_ptrE=20
(/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.2/include/g++-v3/bits/stl_set.h:1=
02)
=3D=3D10037=3D=3D by 0x408F72B4: (within=20
/home/mel/Projects/src/.libs/libmyapp.so.0.0.0)
=3D=3D10037=3D=3D by 0x408C4110: (within=20
/home/mel/Projects/src/.libs/libmyapp.so.0.0.0)
=3D=3D10037=3D=3D by 0x4000AD4B: call_init (in /lib/ld-2.3.1.so)
=3D=3D10037=3D=3D Address 0xBFFFE1C4 is not stack'd, malloc'd or free'=
d
=3D
What is the problem with this? Thank you.
-- Michael
|