Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ResolveAlias leads to crash



On 7/28/05 2:40 PM, Matt Gough didst favor us with:

> 
> On 28 Jul 2005, at 17:43, Laurence Harris wrote:
> 
>>> HLock((Handle)alias);
>>> BlockMove(yourData, *alias, sizeOfYourData);
>>> HUnlock((Handle)alias);
>>> 
>> 
>> FWIW, you don't need to lock handles in Mac OS X. They never move  unless you
>> grow them, and even then only if you grow them beyond their  original size.
>> 
> 
> So how exactly would you grow it without it ending up bigger than the
> original size ;)

You shrink it with SetHandleSize() first.

h = NewHandle( 1000 );
SetHandleSize( h, 100 );
SetHandleSize( h, 1000 ); <- no allocation necessary.

Making a handle smaller doesn't actually release memory in Mac OS X, so if
you regrow it to anything <= the original size, it doesn't need to
reallocate and hence doesn't move.

Larry

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: ResolveAlias leads to crash (From: Matt Gough <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.