• 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: Steve Sisak <email@hidden>
  • Date: Tue, 05 Jul 2016 12:26:49 -0400

On Jul 5, 2016, at 2:27 AM, Jens Alfke <email@hidden> wrote:

If you absolutely need to preflight a huge memory allocation, I suggest creating a temporary file, resizing it to the desired size by setting its EOF, then using mmap to map the file into address space. (You should then unlink the file, ensuring it’ll be cleaned up when your process exits.)

I was going to suggest the same thing.

Basically, do your own VM if the allocation is over some threshold, say 25% or 50% of physical RAM.

This will fail when you resize the file and won’t compete with the system’s VM. If the resize succeeds, you’re good to go.

If your customer is on a SAN with 250GB free it will work — also it gives you the option of backing your huge allocations on a different drive (or drives) than the system VM.

HTH,

-Steve


 _______________________________________________
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

  • Follow-Ups:
    • Re: malloc was optimized out
      • From: Jens Alfke <email@hidden>
References: 
 >Re: malloc was optimized out (From: Dmitry Markman <email@hidden>)
 >Re: malloc was optimized out (From: Roland King <email@hidden>)
 >Re: malloc was optimized out (From: Dmitry Markman <email@hidden>)
 >Re: malloc was optimized out (From: Roland King <email@hidden>)
 >Re: malloc was optimized out (From: Jens Alfke <email@hidden>)
 >Re: malloc was optimized out (From: Dmitry Markman <email@hidden>)
 >Re: malloc was optimized out (From: Jens Alfke <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