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: Is there any way lib GuardMalloc can be faster?




Eric Albert wrote:

On Jan 30, 2006, at 9:03 PM, email@hidden wrote:

I'm wondering exactly why is it so slow. I heard .NET with managed code also has bounds checking etc too. It doesn't seem as slow as GuardMalloc. Is there a specific reason its faster?
Just wondering, because its excruciatingly slow to debug in this mode, almost ridiculous. (no offense intended)

Java also has bounds checking and runs much faster than Guard Malloc. That's because those languages control what you can do in the language in the first place, so they can know that your object at 0x54341510 is an array of 12 integers, and that when you execute an instruction which indexes into the array the index has to be between 0 and 11. C doesn't work that way. There's no runtime environment to figure out what your types are. Everything's just memory addresses and data. There's also no runtime environment to preflight each instruction. Instructions get sent straight through to the hardware.
I see, it makes more sense now.

Since Guard Malloc doesn't have any easy way to check types or instructions, it has to use a sledgehammer. It does that by ensuring that every allocation is on a separate page, typically at the end of the page with a guard page after it. (You can switch that around with an environment variable.) That's not only slow, but it uses tons of memory. The more RAM your system has, the faster Guard Malloc will run. And the faster a computer you have, the faster it'll run.

I find that an Intel iMac with lots of memory works really well for this.
Some how I knew that was the answer.... ^_^

Hope this helps a bit,
Eric
It does, thanks a lot.

Andre
email@hidden



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

This email sent to email@hidden
References: 
 >Is there any way lib GuardMalloc can be faster? (From: email@hidden)
 >Re: Is there any way lib GuardMalloc can be faster? (From: Eric Albert <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.