View Full Version : safe_malloc failed
gynec
21st October 2003, 14:24
i get this error in my junk.txt
safe_malloc failed on allocation of 155713536 bytes
i know i can raise the chopsize. but 8192 is very high. does it affect the cluster size or anything else badly?
And exists another better solution for this error? I heard of a compiler switch which can handle this.
narc
21st October 2003, 15:03
i might be wrong but i think that means you ran out of virtual memory. if you have a larger partition or drive you should set windows to use it for virtual memory.
1. click Control Panel>System>Performance>Virtual Memory
2. then click "Let me specify my own Virtual Memory settings"
3. for hard disk, choose the largest and fastest one.
4. click OK
gynec
21st October 2003, 16:41
methods i know to avoid this memory error:
bigger gridsize (128 or 256)
_lightmapscale 2
_chopsize (sof2=chopsize) > 1024 (2048)
-lomem
-patchshadows off
closing all programs
-fast (light process)
-fastgrid
narc
21st October 2003, 17:44
those options may indeed stop the memory error from occouring but it doesnt really solve the problem. you need more virtual memory.
default windows pagefile is your boot partition on the boot drive. if you have not enough free space there you need to specify another location for windows to use. for example if you had a 200GB drive and the boot partition was only 1GB you will have very little virtual memory. if you made a 50GB partition the swapfile location instead then thats more like it.
Emon
22nd October 2003, 04:19
Eh, it's not a partition exactly, and I'm not sure about Windows having any kind of "boot partition".
Loffy
26th April 2004, 11:53
Hi!
I used the search and found this thread, since I (for the first time) got safe_malloc failure.
I have windows XP. The internal memory is 512 something (Mb?). I went to the Control Panel>>Virtual Memory and increased it to 4000 something (Mb?). (I'm no hacker, that's for sure.) I also added the -lomem switch in my light-stage (in my bat-file).
Problem solved!
// Loffy
PS. What is the switch command to force q3map2 to write a logfile? I mean, a file that I can open after a failed compile, to read for example "safe_malloc failed on allocation of xxxxxxx bytes".
This feature is perhaps already there, and there is no need for a command, but I cannot find a logfile in my q3map2 folder. (I also searched this forum for info. about written logfiles.)
I had to sit by the computer, while it q3map2:ed my elite .map-project, and wait until the "safe_malloc failed"-message appeared. It went away after a couple of seconds!
EDIT!: Apparently this had been discussed before. The keyword was "junk", when searching the forum. I found this, among a number of threads about q3map2 and logfiles:
http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=4874&highlight=junk+txt
ACROBAT
5th August 2007, 14:50
What does _chopsize do? I searched google and I've never even heard of that command.
Also is safe_malloc mean it's failing on the -light phase or the -vis phase.
I was under the impression that it was in the -light phase so if you raise the _lightmapscale up to 64 that should have solved it. weird if it doesn't solve the problem...
-lomem will help a little.
_gridsize helps but so marginally that it's kind of pointless to bother with it.
_blocksize probably won't matter if it's failing in the -light part of the compile although it might speed the compile up.
I was under the impression that -fastgrid was a weak version of -fast.
obsidian
6th August 2007, 03:11
Windows virtual memory is called a Page File. In Task Manager, under Performance, you can actually see the amount of the total page file in use. Windows stores the pagefile in a file called, umm... pagefile.sys that is a hidden file located on one of your hard drives (by default C:\). If you enable hidden files to be viewable in folder options, you will see it sitting there.
As mentioned above, you can manually set it to different values if you know what you are doing. I wouldn't recommend messing with it if you are unfamiliar with it. Truth in that for best performance, it should be located on your fastest (though not necessarily your largest) and/or most idle hard drive and even better if it resides in it's own partition to prevent disc fragmentation.
The page file by default can change size as needed, but to prevent fragmentation, it is often wise to set a fixed page file size. The general rule of thumb for page file maximum and minimum sizes is 1.5x the amount of installed RAM on your system. I would NOT recommend creating a 50GB swap file.
I have my page file sitting on my second hard drive (non system disc) under it's own partition set to 3GB in size (2GB RAM).
Note, this applies to Windows XP. I believe that there are a few changes in Vista with regards to how virtual memory is handled so all of the above may not apply.
obsidian
6th August 2007, 03:26
Best way to prevent this error is to optimize your map. I have never run into this error myself and I have created some pretty large/crazy ones in the past. Failing that, -lomem might help. I believe it saves temp data to your computer as a way of clearing memory, as a result it's slower. Randomly changing your page file size arbitrarily will likely affect your system's stability.
@Loffy: ">" is not a Q3Map2 command, it's a DOS command. It instructs DOS to output all data from the command window to a text file. There is quite a list of commands that might come in handy with batch files.
@ACROBAT: I believe _chopsize is the SoF2 equivalent of _blocksize, though I don't do anything related to SoF2, so I can't be sure.
Shallow
6th August 2007, 17:31
There should be a function in the forums software which draws progressively larger numbers of little cobweb graphics over the corners of old posts, so people can easily see the cutoff between old and new in necrobumped threads.
obsidian
6th August 2007, 20:36
lol... thanks for pointing that out.
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.