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: Dynamically growable/shrinkable block of RAM?



Hi there,

Thanks, that looks very powerful, but I need my code to work on both OS9, and OSX. So SetHandle is something I'm considering.

I'm hoping that on OSX, SetHandle is a wrapper to realloc?

I'm sure someone knows the best way to do this for both OS9 and OSX? Its probably a question every Carbon expert has considered at sometime.

Of course I could use one code on OS9, and another on OSX, but I'd rather keep my code simple, as I'm rather time-strapped.

The answer, on Mac OS X is vm_allocate/vm_deallocate.

So, right now, I'm using malloc/realloc, which in turn on OSX, is a
wrapper to NewPtr and BlockMoveData. This wrapping is done by
CodeWarrior's libraries (which of course the source to is included!)

So, thats MW ANSI malloc -> Carbon NewPtr -> Mach malloc -> Mach
vm_allocate.

I would not recommend writing your own malloc replacement on top of
vm_allocate; the Mach malloc is performs quite well. But if you have a
special need for a super-high-performance page allocator, vm_allocate
might be the way to go.
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.



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.