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: "Handles don't move on Mac OS X"



On 7/28/05 9:41 PM, David A. Lyons didst favor us with:

> On Jul 28, 2005, at 12:07 PM, David Duncan wrote:
> 
>>> You shrink it with SetHandleSize() first.
>>> 
>>> h = NewHandle( 1000 );
>>> SetHandleSize( h, 100 );
>>> SetHandleSize( h, 1000 ); <- no allocation necessary.
>>> 
>> 
>> There is also the potential that your original allocation was
>> rounded up. I think the current threshold is 12K - allocations
>> greater than that are page rounded, so if you asked for say 13K,
>> then your allocation would be 16K - if you never grow beyond 16K
>> the handle won't move.
> 
> Have we crossed back over the line, yet, into implementation details
> that can't be counted on?
> 
> I'm willing to believe there is documentation saying "handles in Mac
> OS X will never move unless you grow them, so you pretty much never
> need HLock any more" but is anything beyond that actually guaranteed?

No. I would never *rely* on a handle not being grown in the example above, I
was only explaining why I worded my comment the way I did. However, the
current implementation is optimized for performance and I don't expect that
to change. Actually releasing memory when downsizing a handle would require
a new allocation and copying the current data, and certainly there's no
reason the reallocate and copy if the currently allocation is large enough
to hold the new size.

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: "Handles don't move on Mac OS X" (From: "David A. Lyons" <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.