|
|
#21 |
|
Triple-A Player
Join Date: Apr 2003
Location: /dev/bpf1
Posts: 220
|
Well, swapfiles are used to temporarily store data which is occupying space in memory and is not being used. Now, I don't know if there is a way to delimit the number of swapfiles, and there probably is a way, but erasing them could be solution. I have read that erasing swapfiles may screw some systems. What do you mean by cleaning them? Frankly I don't know how the system manages these files. Perhaps a better reference on the subject would help for all of us.
Tuesday
__________________
The True Master is the One Who Never Stops Learning. |
|
|
|
|
|
#22 | |||||||||||||||||||
|
Prospect
Join Date: Jul 2003
Posts: 9
|
Right -- swapfiles are how OS X (and its unix cousins) handle virtual memory. If something requests more memory than you have physically available, a swapfile is created and memory that hasn't been used for a while is "swapped out" so that the physical RAM can be used to handle the new request. Unlike Mac OS 9, which had a single file that contained all of the available virtual memory pre-allocated at boot time, Mac OS X dynamically increases the number of swapfiles as needed, in 80MB chunks -- if both your physical RAM and swapfiles are full, it will create a new swapfile. It would indeed be extremely hazardous to try to delete a swapfile while the system is using them. You certainly shouldn't delete a swapfile while VM is using it. However, this seems like it should be something that is cleaned up at startup, just before VM is started (or possibly at a regular interval with cron, if there is something that can detect when a swapfile has no "live" memory chunks in it). The fact that I had 24 swapfiles could indicate that I tried to use, in addition to the 1GB of RAM built in, another almost 2GB of memory space at some point. Or, it could indicate that I often went a little bit over, on 24 occasions separated by reboots, and the swapfiles are never cleaned up or reused after a restart. I'm not sure which is true. I wouldn't put it past myself to have run things that wanted 3GB of memory, but on the other hand I don't think my usage is that unusal and most people usually have (as you do) something more like 4 swapfiles. Particularly if the latter scenario is true, this does seem like knowledge that should be better disseminated (that is to say, if there is something that needs to be done manually to clean up old unused swapfiles from before a preceding reboot). ? |
|||||||||||||||||||
|
|
|
|
|
#23 | |||||||||||||||||||
|
Prospect
Join Date: Jul 2003
Posts: 9
|
Yes, here we go. From my /etc/rc file: Code:
##
# Start the virtual memory system.
##
ConsoleMessage "Starting virtual memory"
swapdir=/private/var/vm
if [ "${netboot}" = "1" ]; then
sh /etc/rc.netboot setup_vm ${swapdir}
fi
# Make sure the swapfile exists
if [ ! -d ${swapdir} ]; then
ConsoleMessage "Creating default swap directory"
mount -uw /
mkdir -p -m 755 ${swapdir}
chown root:wheel ${swapdir}
else
rm -rf ${swapdir}/swap*
fi
|
|||||||||||||||||||
|
|
|
|
|
#24 | |||||||||||||||||||
|
All Star
Join Date: Feb 2002
Location: peteyville
Posts: 794
|
Re: Re: full disks
this is a new one to me. anyone have any explanation? |
|||||||||||||||||||
|
|
|
|
|
#25 |
|
Triple-A Player
Join Date: Apr 2003
Location: /dev/bpf1
Posts: 220
|
Good sleuthing paul. But if this is so why do you have 24 swapfiles even after frequent reboots? Maybe you should just reboot for a moment and check the /private/var/vm directory to see if there are as many swapfiles as before. If not, then some program you are running either has a memory leak or it is just very memory intensive and you don't have enough physical memory. Check the "top" output specifically for virtual memory used by programs. If you find something quite excessive, then you may have found the target program. But anyway, we have deviated. Since you have defragmented, this problem should not occur anymore, right? As well, going back to the original problem, there are many things which can cause the WM to crash or stop responding. This may very well have been one, but I would think if there was a problem with this, then the whole system would be affected, it would be a total system crash. Most WM crashes are caused from internal bugs within the windowserver program itself.
Tuesday
__________________
The True Master is the One Who Never Stops Learning. |
|
|
|
![]() |
|
|