• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: malloc was optimized out
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: malloc was optimized out


  • Subject: Re: malloc was optimized out
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 04 Jul 2016 21:41:47 -0700
  • Feedback-id: 167118m:167118agrif8a:167118subItQ5Tl4:SMTPCORP

On Jul 4, 2016, at 20:55 , Dmitry Markman <email@hidden> 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      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >malloc was optimized out (From: Dmitry Markman <email@hidden>)
 >Re: malloc was optimized out (From: Clark Cox <email@hidden>)
 >Re: malloc was optimized out (From: Dmitry Markman <email@hidden>)
 >Re: malloc was optimized out (From: Clark Cox <email@hidden>)
 >Re: malloc was optimized out (From: Dmitry Markman <email@hidden>)
 >Re: malloc was optimized out (From: Clark Cox <email@hidden>)
 >Re: malloc was optimized out (From: Dmitry Markman <email@hidden>)
 >Re: malloc was optimized out (From: Carl Hoefs <email@hidden>)
 >Re: malloc was optimized out (From: Dmitry Markman <email@hidden>)
 >Re: malloc was optimized out (From: Chris Cleeland <email@hidden>)
 >Re: malloc was optimized out (From: Dmitry Markman <email@hidden>)

  • Prev by Date: Re: malloc was optimized out
  • Next by Date: Re: malloc was optimized out
  • Previous by thread: Re: malloc was optimized out
  • Next by thread: Re: malloc was optimized out
  • Index(es):
    • Date
    • Thread