• 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: Is there a 1GB memory ceiling for vm_allocate?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is there a 1GB memory ceiling for vm_allocate?


  • Subject: Re: Is there a 1GB memory ceiling for vm_allocate?
  • From: Robert Purves <email@hidden>
  • Date: Wed, 24 Jan 2007 17:48:38 +1300


John Bullitt wrote:

I'm trying to push_back() a bunch of elements into a vector. When
push-back() tries to allocate more than 1GB, it fails.

For example, the following little program will push_back() until it
runs out of memory:

#include <vector>
int main (int argc, char * const argv[]) {
	std::vector<char> z;
	unsigned long int n;
	for (n=0;;n++) {
		z.push_back(0);
	}
}

I get an error like this:  "malloc: *** vm_allocate(size=1073741824)
failed (error code=3)" .

Why is it running out of memory so soon? My G5 has 5 GB of RAM and
175GB free disk space. I'm baffled.

Roughly 3.5 GB of the theoretical 4 GB address space is available for allocation by an app. However you can't get all that in one chunk; it's already fragmented by the time the app starts. Typically the largest successful block request is about 1.5 GB.


Use MaxVBlock() as a diagnostic aid to study the vm capabilities:
<http://lists.apple.com/archives/Carbon-dev/2005/Jan/msg01202.html>

Robert P.

_______________________________________________
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: Is there a 1GB memory ceiling for vm_allocate?
      • From: Steve Checkoway <email@hidden>
  • Prev by Date: [SOLVED] Xcode chockes on variable-sized arrays in struct definitions
  • Next by Date: Re: Is there a 1GB memory ceiling for vm_allocate?
  • Previous by thread: Re: Is there a 1GB memory ceiling for vm_allocate?
  • Next by thread: Re: Is there a 1GB memory ceiling for vm_allocate?
  • Index(es):
    • Date
    • Thread