logo       

FW: [jreed@xxxxxxxxxxxx: Csharp module and memory pressure on GC]: msg#00149

programming.swig

Subject: FW: [jreed@xxxxxxxxxxxx: Csharp module and memory pressure on GC]



-----Original Message-----
From: Joel Reed [mailto:jreed@xxxxxxxxxxxx]
Sent: 22 September 2004 22:12
To: Fulton, William
Subject: [jreed@xxxxxxxxxxxx: Csharp module and memory pressure on GC]


William, another msg caught by swig's spam traps. Thought you
might be interested since it is C# related.

----- Forwarded message from Joel Reed <jreed@xxxxxxxxxxxx> -----

> From: Joel Reed <jreed@xxxxxxxxxxxx>
> Subject: Csharp module and memory pressure on GC
>
> This is a complicated issue involving the .Net garbage
> collector, and swigCPtr's.
>
> Problem:
>
> 1) create two c++ classes where 1 class uses
> the facilities of another. eg:
>
> class o_dbc {
> };
>
> class o_dim {
> public: o_dim(o_dbc& db);
> };
>
> 2) generate csharp wrappers for these classes
>
> 3) use these classes while creating enough memory
> pressure on the garbage collector such that one of the
> objects is reclaimed, even though the other object
> still has a swigCPtr reference to the just reclaimed object.
> (we generated this reclaimation with 6 to 10 65k strings)
>
> 4) as soon as the still-live object tries to use
> the swigCPtr to the reclaimed object, an exception occurs.
>
> I'm wondering if swig's outputted csharp code could be
> augmented such that an object which uses getCPtr from another
> object could setup a HandleRef or GCHandle so that the CLR
> would be informed that the objects depend upon each other,
> preventing either from being prematurely reclaimed.
>
> I changed by hand the swig *.cs files and using HandleRef
> does fix the problem. My only concern now is if I know
> enough swig internals to make a patch...
>
> jr

--
------------------------------------------------------------
Joel W. Reed 412-257-3881
---------- http://home.comcast.net/~joelwreed/ ----------

Visit our website at http://www.ubs.com

This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission. If
verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.

_______________________________________________
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