On Jul 4, 2016, at 20:55 , Dmitry Markman <dmark...@mac.com> wrote:
> 
> Theoretically clang isn’t right … code should behave identically for debug 
> and release build

You’re going to have to give this up. Both of these statements are false, as 
numerous people have tried to point out, in various more or less polite ways.

— Clang is theoretically right, because it provides conforming behavior with 
regard to error reporting (if there’s an error, it reports it). There is no C 
spec requirement regarding the implementation of error detection for malloc. 
Again, lack of physical memory is not necessarily an error in general, though 
it is to you.

— Code in general may behave differently between debug and release builds. If 
there were a such a requirement, optimization would be illegal in general, 
because it changes the timing of code execution, which makes the code behave 
non-identically. As others have said, in your case the difference *is* timing — 
the timing of when physical memory is mapped into your address space — and you 
won’t find any requirements about *that* in the C spec.

Getting back to your problem, your real solution is to detect, catch and handle 
the crash that otherwise occurs when VM mapping fails. This may be unappealing, 
but your app is unusual in that it routinely uses huge quantities of memory, so 
you’re faced with implementation choices that are harder than for the rest of 
us who write apps with modest memory needs.

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

This email sent to arch...@mail-archive.com

Reply via email to