From: William S F. <ws...@fu...> - 2012-09-05 19:51:33
|
On 05/09/12 12:30, Nataraja wrote: > Hi , > Look into this > > File main.cpp has function declartion > > std::list<INST*> get_Inst() > { > return this->inst; > } > > > File main_wrap.cxx has this > _wrap INST_get_Inst () { > ....................... > result = (arg1)->get_Inst(); > Tcl_SetObjResult(interp,SWIG_NewInstanceObj((new std::list<INST * > >(static_cast< const std::list<INST * >& >(result))), > SWIGTYPE_p_std__listTINST_p_t, SWIG_POINTER_OWN | 0 )); > ...... > } > > so every time I'm calling get_Inst from tcl shell > a NEW Tcl Object is being created but we are not freeing this memory > anywhere , so my doubt is are we leaking memory ? > The SWIG_POINTER_OWN indicates that SWIG takes ownership of the memory. I'm not too familiar with Tcl, but you should find that the memory gets cleared up with whatever is the usual mechanism for Tcl memory management. William |