Teen Programmers Unite  
 

 

Return to forum top

Memoryleaks

Posted by CViper [send private reply] at March 17, 2003, 02:49:12 PM

Ok, this is a bit OT, but it really p****s me off... I've been running win98 for quite some while, without problems (well, no substantial anyway). But lately my available physical memory goes down to 20 to 120 kbytes (out of 256 mb) after some time. Can't figure out what's eating my memory; it's none of my own software anyway (I'm not running any).

Even if I shut down everything the free physical memory stays at those levels (+ some memory that's used by the stuff I shut down, usually only 1-2 mb).

Anybody got a good way to track down what app's having all my memory for breakfeast?

Posted by CodeRed [send private reply] at March 17, 2003, 10:39:36 PM

No, not in win98, but their are several programs designed to free up memory that was not released by terminated applications.

Posted by Mike_L [send private reply] at March 21, 2003, 01:42:24 PM

Perhaps the memory is being allocated to the filesystem cache? In that case, when your programs actually need it, it will be deallocated from the cache and given to the programs. Are you now dealing with very large files while previously you did not?

Here is the printout from "top" on Linux:
Mem: 506032K total, 495028K used, 11004K free, 19692K buffers
Swap: 0K total, 0K used, 0K free, 260628K cached

Note that there is about 500MB of total memory. Only 11MB is listed as free. But please notice the 260MB used by cache. That means that nearly half of the memory currently holds data from files that have been recently read or written to. If a program needs to access any of those files again, it will come from memory instead of having to be read from the disk drive.

The actual memory usage on the system is 495MB - 260MB = 235MB. Also note that there is no swap file. If you have 256MB of RAM then a swap file is just useless. It will only save you maybe 5MB by storing RAM that rarely gets accessed. Swap files can cause a lot of problems in certain situations. For instance, a runaway program that tries to allocate 1GB of memory will cause your computer to slow to a crawl. This is because all of the programs will constantly be waiting for their memory to be swapped in/out of memory. Without a swap file, a runaway program will reach the memory limit very quickly and then terminate.

Posted by CViper [send private reply] at March 21, 2003, 03:22:50 PM

Hmm, ok, since no application is using the memory, I'll assume it's the system cache... The general performance isn't worse than usuall either.

Posted by CodeRed [send private reply] at March 23, 2003, 03:53:48 PM

Set up a static 512mb swap file

Posted by Mike_L [send private reply] at March 23, 2003, 05:48:28 PM

CodeRed said:
> Set up a static 512mb swap file

Why? Did you even read what I wrote above?

Posted by unknown_lamer [send private reply] at March 23, 2003, 05:56:49 PM

Swap is good. XFree86 has huge memory leaks and slowly grows over time. If you don't have a swap file, eventually it will eat all your memory and you get an OOM kill. Oops. All of your X stuff is gone. No chance to gracefull exit anything. OOM kills are not good. At least with a swap file you can gracefully restart X every month or so.

Also, try editing huge images or doing eight track audio recording/editing with only 256MB of ram and no swap file. Hint: not pretty. On my system at least, about 100MB of stuff is swapped out. This gives me 100MB more free physical memory for a disk cache (I run lots of stuff like an ORB or two, GDOMapper for GNUStep, dictd, etc. that I rarely use and so they get swapped out).

You want swap. You want lots of swap. No swap is bad. It hurts performance by limiting the size of the disk cache. With the new memory management stuff in Linux 2.5, the whole "the system will crawl to a halt!" argument is meaningless anyway.

Posted by CodeRed [send private reply] at March 24, 2003, 01:41:03 AM

Mike_L: Are you insane? With only 256mb of memory you ABSOLUTELY NEED a swap file. 256mb is the bare minimum that I would suggest anyone to use nowadays, 512mb to 1gb is more common and will be necessary in the near future. I would only disable the swap file with 1gb or more. And you forgot one thing, he is using win98, not linux, maybe you should read the original question and understand it before offering your advice

Posted by DragonWolf [send private reply] at March 24, 2003, 06:10:42 AM

I can't remember if the system monitor was any good with win98. But in win2k you can get it to monitor the memory levels of every program (Real memory and Virtual memory) in-use at any point in time (either outputting a graph or saving to a log file)

Using this you should be able to see what program is causing the memory leak and at what point in time (and hence find the action that is causing the leak)

Posted by Mike_L [send private reply] at March 24, 2003, 02:33:04 PM

An efficient system does not have large stupid daemons running in the background holding data that exists on the disk drive. I've never noticed memory leaks in X. Maybe it's because I use a Window manager that correctly destroys its X system resources, Window Maker.

On a properly optimized Win98 system, a swap file will save you less than 10MB of memory, and it WILL increase your startup/shutdown times.

As for applications like image and sound editors, you really don't want to be editing huge (8192x8192) images with only 256MB of RAM. If your image editing program does not have its own swap capability, then you will have to use a system swap file. Unfortunately, this will result in your ENTIRE system running poorly, instead of just having to wait for your image editor to render your changes.

The fact of the matter is that the time of swap files is over.

You must be logged in to post messages and see which you have already read.

Log on
Username:
Password:
Save for later automatic logon

Register as a new user
 
Copyright TPU 2002. See the Credits and About TPU for more information.