Swap file limitations of OSX?

Fahrvergnuugen

I am the law!
Is there a limitation to the amount of memory [both virtual and physical] that an application can use?

I'm getting this error when trying to run a php script that i wrote [yes, its supposed to use a ton of ram, its doing something rather amazing...]
*** malloc: vm_allocate(size=262144) failed with 3
*** malloc[1146]: error: Can't allocate region
FATAL: emalloc(): Unable to allocate 260000 bytes
 
its assembling over a million photographs into one giant image which will be 65,000 pixels wide by 65,000 pixels tall [limited by the capabilities of GD].
 
And you can't up the RAM to 1.5 GB?

AFAIK, OS X uses invisible files to use as Virtual Memory. I don't know how big these files are, but they are limited (naturally) by the size of your hard drive. Do you have a lot of HD space left?

What's GD, BTW?
 
I'm already maxed out on physical ram. 1.2GB isn't nearly enough RAM to allocate a truetype image thats 65,000 * 65,000 pixels.

as soon as PHP has consumed 4GB of virtual memory, it errors out. I watched its progress in top:

1164 php 85.6% 1:21.70 1 12 21673 1.12G+ 64K 144M- 3.99G+
 
One thing that you could try, is typing: ls -Fal /private/var/vm in a terminal window and see how many swapfile(s) the os has made. If there are quite a few, then yes you are hitting the vm pretty hard.

Another possibility is that you are encountering the infamous malloc bug that has been part of os x since its days as next step.

I encountered this bug while doing a program in c for a class I was taking. One of my instructors friends still does some developement for open/next step, and he said that there has been a problem with malloc for years.

Infact he also said that many next programmers ended up writing there own version of malloc to bypass this bug.

Doing a search on google verified this malloc bug does/did exist.

Again, this might not have anything to do with the problem that you are encountering.

I'd check the /private/var/vm directory first for the number of swap files, if that isn't it then maybe the other info I gave you could help.

Good luck
 
naodx, thanks for the info on malloc, I'll see what I can find.

Heres what my vm directory looks like :eek:
[darklotus:~] reloaded% ls -Fal /private/var/vm/
total 3281376
drwxr-xr-x 45 root wheel 1530 Aug 26 22:38 ./
drwxr-xr-x 22 root wheel 748 Aug 25 17:57 ../
drwx--x--x 12 root wheel 408 Aug 25 17:48 app_profile/
-rw------T 1 root wheel 80000000 Aug 25 17:57 swapfile0
-rw------T 1 root wheel 80000000 Aug 25 21:47 swapfile1
-rw------T 1 root wheel 80000000 Aug 26 11:02 swapfile10
-rw------T 1 root wheel 80000000 Aug 26 11:02 swapfile11
-rw------T 1 root wheel 80000000 Aug 26 20:23 swapfile12
-rw------T 1 root wheel 80000000 Aug 26 20:23 swapfile13
-rw------T 1 root wheel 80000000 Aug 26 20:23 swapfile14
-rw------T 1 root wheel 80000000 Aug 26 20:23 swapfile15
-rw------T 1 root wheel 80000000 Aug 26 20:24 swapfile16
-rw------T 1 root wheel 80000000 Aug 26 20:24 swapfile17
-rw------T 1 root wheel 80000000 Aug 26 20:24 swapfile18
-rw------T 1 root wheel 80000000 Aug 26 22:32 swapfile19
-rw------T 1 root wheel 80000000 Aug 25 21:47 swapfile2
-rw------T 1 root wheel 80000000 Aug 26 22:32 swapfile20
-rw------T 1 root wheel 80000000 Aug 26 22:32 swapfile21
-rw------T 1 root wheel 80000000 Aug 26 22:32 swapfile22
-rw------T 1 root wheel 80000000 Aug 26 22:32 swapfile23
-rw------T 1 root wheel 80000000 Aug 26 22:33 swapfile24
-rw------T 1 root wheel 80000000 Aug 26 22:33 swapfile25
-rw------T 1 root wheel 80000000 Aug 26 22:33 swapfile26
-rw------T 1 root wheel 80000000 Aug 26 22:33 swapfile27
-rw------T 1 root wheel 80000000 Aug 26 22:33 swapfile28
-rw------T 1 root wheel 80000000 Aug 26 22:33 swapfile29
-rw------T 1 root wheel 80000000 Aug 25 21:48 swapfile3
-rw------T 1 root wheel 80000000 Aug 26 22:33 swapfile30
-rw------T 1 root wheel 80000000 Aug 26 22:34 swapfile31
-rw------T 1 root wheel 80000000 Aug 26 22:34 swapfile32
-rw------T 1 root wheel 80000000 Aug 26 22:35 swapfile33
-rw------T 1 root wheel 80000000 Aug 26 22:35 swapfile34
-rw------T 1 root wheel 80000000 Aug 26 22:35 swapfile35
-rw------T 1 root wheel 80000000 Aug 26 22:36 swapfile36
-rw------T 1 root wheel 80000000 Aug 26 22:36 swapfile37
-rw------T 1 root wheel 80000000 Aug 26 22:37 swapfile38
-rw------T 1 root wheel 80000000 Aug 26 22:37 swapfile39
-rw------T 1 root wheel 80000000 Aug 26 11:01 swapfile4
-rw------T 1 root wheel 80000000 Aug 26 22:38 swapfile40
-rw------T 1 root wheel 80000000 Aug 26 22:38 swapfile41
-rw------T 1 root wheel 80000000 Aug 26 11:01 swapfile5
-rw------T 1 root wheel 80000000 Aug 26 11:01 swapfile6
-rw------T 1 root wheel 80000000 Aug 26 11:01 swapfile7
-rw------T 1 root wheel 80000000 Aug 26 11:01 swapfile8
-rw------T 1 root wheel 80000000 Aug 26 11:02 swapfile9
 
Ya, I'd say you were hitting the hard drive pretty good....and I'm not sure where you would find any information on size limitations for vm.

Maybe on apple's developer site?
 
Back
Top