• 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: Accessing buffers in NSData/NSMutableData under garbage collection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing buffers in NSData/NSMutableData under garbage collection


  • Subject: Re: Accessing buffers in NSData/NSMutableData under garbage collection
  • From: Chris Suter <email@hidden>
  • Date: Wed, 20 Feb 2008 09:42:03 +1100


On 20/02/2008, at 8:12 AM, Quincey Morris wrote:

which means there are 3 possible avenues for dealing with this case of optimization fragility, not just the 2 you mentioned:

1. Enhance GC (code generation and runtime) to work with interior pointers.

I'm not convinced this would work. See earlier e-mail.

2. Be careful not to let the non-interior pointer variable's lifetime expire before you're done with the interior pointer.

This is little better than using malloc and free.

and

3. Enhance Objective-C -- to warn about or disallow certain patterns of interior pointer usage, say, or to generate code that preserves the base pointer reference when pointer arithmetic is used.

This won't work for libraries that you have no control over. For example, you might pass -[NSString UTF8String] to other library routines that aren't Objective C and have no knowledge of garbage collection (which is a fairly common usage pattern).


The only solution that I can see is viable is the one I proposed—use autoreleased memory for these kinds of temporary objects.

- Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Follow-Ups:
    • Re: Accessing buffers in NSData/NSMutableData under garbage collection
      • From: Quincey Morris <email@hidden>
References: 
 >Accessing buffers in NSData/NSMutableData under garbage collection (From: Rick Hoge <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: Adam P Jenkins <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: mmalc crawford <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: Adam P Jenkins <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: Adam P Jenkins <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: Chris Suter <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: Alastair Houghton <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: Quincey Morris <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: "Michael Ash" <email@hidden>)
 >Re: Accessing buffers in NSData/NSMutableData under garbage collection (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: *** -[NSCFDictionary setObject:forKey:]: mutating method sent to immutable object
  • Next by Date: Core Data help needed (relationship programmatically)
  • Previous by thread: Re: Accessing buffers in NSData/NSMutableData under garbage collection
  • Next by thread: Re: Accessing buffers in NSData/NSMutableData under garbage collection
  • Index(es):
    • Date
    • Thread