David Notario
David Notario

Reputation: 297

Is there any document/page explaining in detail how monotouch handles memory management / object lifetime of unmanaged (NSObject) objects

I've read the small section about Dispose() in http://monotouch.net/Documentation/API_Design and a similar question asked in monotouch forums before: http://forums.monotouch.net/yaf_postst136_Memory-Management-Questions.aspx . However, I'm still a bit confused about how things are really working under the covers.

I assume things work in a similar way to the .NET COM RCWs (http://msdn.microsoft.com/en-us/library/ms973274.aspx), but I'm trying to make sure this is the case.

Knowing exactly how things work will help me answer questions like, for example, if I SetImage on a UIButton, am I now free to dispose the UIImage I just assigned, as the underlying UIKit button control will be the only thing using the native UIImage (and that the managed UIButton will not use the managed object I assigned in any way).

I will gladly contribute to the monotouch wiki myself once I understand how things work.

Upvotes: 2

Views: 308

Answers (1)

miguel.de.icaza
miguel.de.icaza

Reputation: 32694

I have tried to summarize the various issues here:

http://monotouch.net/Documentation/API_Design#Memory_Management

Please ask me any questions you want, and I will answer by extending the document.

Upvotes: 2

Related Questions