• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Deallocating cocoa distant objects.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: strange menu item key equivalent behavior
  • Next by Date: NSScrollView, NSTableView and NSSplitView Glitch
  • Previous by thread: Re: Deallocating cocoa distant objects.
  • Next by thread: How to use CFReadStrem and abort read stream normally?
  • Index(es):
    • Date
    • Thread