From: William S F. <ws...@fu...> - 2013-11-25 07:06:41
|
On 28/10/13 21:00, Mark Galeck wrote: > Hello, > > I am getting this warning when running > > >swig -module foobar -python -c++ -shadow -outdir dist foobar.i > > > foobar.h:51: Warning 454: Setting a pointer/reference variable may leak > memory. > > That line in foobar.h is: static foobar *sInstance; > > > I can't find any explanation for this warning 454 in the documentation. > What is this and how to avoid it? > The warning comes from the varin typemaps for pointers and references. The new value is assigned to the global variable, but does not call free or delete on the previous value. This may or may not create a memory leak, depending on what the memory management strategy is meant to be used for that variable. William |