Re: Deallocating cocoa distant objects.
Re: Deallocating cocoa distant objects.
- Subject: Re: Deallocating cocoa distant objects.
- From: Ken Thomases <email@hidden>
- Date: Sat, 23 May 2009 18:00:12 -0500
Hi,
Have you tried the approach where the server's methods return objects
rather than outputting them through pointer parameters? That's more
typical. Also, I'd point out that all of your methods which return
HRESULT type are hard-coded to always return S_OK, or, if they aren't
hard-coded, their result depends only on methods which are hard-
coded. So, all of that HRESULT handling is wasted complexity.
More importantly, the existence and use of the -releaseMyself method
raises alarm bells. You should never have or need such a thing.
Memory management in the presence of Distributed Objects should
generally follow the same patterns as other memory management. In
particular, the server should manage its own memory and the client
should manage its own. You should not have the client attempting to
manage the server's memory.
When the server returns an object that it doesn't otherwise need to
keep around for its own purposes, it should autorelease it. The
client, when it receives such an object, should retain it (locally) if
it needs to keep it around. When it's done with it, it should balance
that retain with a release or autorelease (again, locally). The
client should _not_ send a message to the server to ask the server to
release something. Similarly, the client should not fail to release
its proxy. Your code seems to break both of those guidelines.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden