• 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: "Michael Ash" <email@hidden>
  • Date: Tue, 19 Feb 2008 14:03:41 -0500

On Feb 19, 2008 1:36 PM, Quincey Morris <email@hidden> wrote:
> Furthermore, your example made me wonder if there's another
> optimization hole, that has nothing to do with interior pointers, but
> which also reflects a variable lifetime indeterminacy:
>
>    __weak NSString* string1 = [@"string1" copy];
>    NSString* string2 = @"string2";
>    [[NSGarbageCollector defaultCollector] collectExhaustively];
>
> Couldn't this result in the garbage collector zeroing 'string2' under
> unlucky (but common) optimization conditions?

All local variables (variables stored on the stack and in registers)
are strong. Even the ones marked __weak. __weak (and __strong) only
apply for variables stored on the heap.

Mike
_______________________________________________

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>
    • Re: Accessing buffers in NSData/NSMutableData under garbage collection
      • From: Alastair Houghton <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>)

  • Prev by Date: Re: Accessing buffers in NSData/NSMutableData under garbage collection
  • Next by Date: Re: Front and back flip animation
  • 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