logo       

Re: how to prevent objects from being garbage collected.: msg#00123

programming.swig

Subject: Re: how to prevent objects from being garbage collected.

Here's one less-than ideal way:

Go into your wrap_*.cxx file and change the names of the wrap_delete
functions to be something else. Then you can explicitly call those when
you want to garbage-collect. You may have to write empty wrap_delete
functions to replace the ones you changed, as I've never tried this.

Of course the ideal way would be to sever the destructor call link in
the cxx file, but I can't find that.

On Mon, 24 May 2004, meinrad recheis wrote:

> hi,
>
> is there a way to prevent objects from being destructed by the ruby
> garbage collector or at the end of the script, without having to write
> markfunks for the owner of these objects?
>
> also user defined markfuncs for the containers would not help me with
> the problem at the end of the script, i think.
>
> when ruby exits, all objects will be deleted and their C++ destructors
> get called. if objects that are owned by others (in C++) are deleted
> bevore their owners the owners will try to free them again and that
> leads to memory access errors.
>
> how can i tell ruby to not call the destructor of certain objects??
> maybe i didn't understand something right, so please clarify.
>
> any comments are very appreciated!!
> thanks,
> - henon
> _______________________________________________
> Swig maillist - Swig@xxxxxxxxxxxxxxx
> http://mailman.cs.uchicago.edu/mailman/listinfo/swig
>


_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise