Restricting an application to a hard RAM limit

Using applications, configuring, problems
Post Reply
Message
Author
lappup
Posts: 10
Joined: Sat 21 Feb 2009, 05:29

Restricting an application to a hard RAM limit

#1 Post by lappup »

Hi,

I'm running Puppy on several machines, and for ham radio use a disposable laptop (MMX 233) so I don't care if it gets lost, or stolen out of the car, broken in the field, or whatever.

It works great with 128 MB RAM for everything Puppy does, except for web browsing. If I run Firefox, or Seamonkey, the RAM utilization goes skyhigh. Running Seamonkey on wired.com, the machine slowed to where I thought it wasn't even responding. Running top from command line showed Seamonkey using 130 MB by itself, and reported it was using over 100% of the RAM.

Firefox is a little better, but still uses around 80MB of the physical RAM on some pages. With no browser running, I can run OpenOffice, my radio software, and a couple of graphic utilities without any problems at all.

Is there a way in puppy to restrict the amount of RAM that Seamonkey or Firefox can use? Should I just give up trying to use it for the occasional website?
User avatar
Béèm
Posts: 11763
Joined: Wed 22 Nov 2006, 00:47
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

#2 Post by Béèm »

Use a swap file or partition. (at least 2 1/2 your ram size)
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#3 Post by mikeb »

Google usually can find ways of setting hidden settings to limit mozilla browser memory usage...or have a look at about:config under cache and memory and have a play.

Firefox One was better on memory but does not support all web pages.

mike
DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

Re: Restricting an application to a hard RAM limit

#4 Post by DMcCunney »

lappup wrote:Is there a way in puppy to restrict the amount of RAM that Seamonkey or Firefox can use? Should I just give up trying to use it for the occasional website?
I don't know a way in Linux to restrict the amount of RAM an app may use. And if there was one, what would happen if the app needed more RAM than the limit you set? It might fail to load at all, or die horribly while up because it couldn't get a required resource.

If you don't have one, you need to create a swap partition.

Remember, Linux, like Windows, is a virtual memory system. The OS divides available RAM into 4K pages, and keeps track of what is in each page. If more physical RAM is needed for something than is available, the OS swaps pages not recently used to disk. On Linux, this is normally done to a swap partition on disk. On Windows, this is done to pagefile.sys, which is created by default in the root directory of the boot drive.

When something tries to access a page not in RAM, a "page fault" is generated, and the OS swaps the need page back to RAM from disk. This happens transparently to you and your programs. Your total virtual memory will be the sum of physical RAM plus the size of the swap file. Applications thing they have all of virtual memory to play in.

Of course, to be able to free RAM, by swapping pages to disk, you must have a place to swap to.

SeaMonkey and Firefox both want lots of RAM, and will want more as they are used, as each tab you open requires additional RAM. Allocate a swap partition at least twice as large as available RAM.

In general, more RAM is the best performance upgrade for a system. Memory is an order of magnitude faster than disk, and anything that reduces the need to swap aids performance.
______
Dennis
User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#5 Post by mikeb »

Ok one example
http://www.devwebpro.com/8-great-tips-t ... ory-usage/
section 5 looks most relevant for you.

This is about reducing memory usage to avoid running on swap....using Go office instead of Open office meant it opened presentations without constantly swapping to swap on one machine...good software makes a big difference and throwing memory at bad ones is dealing with the symptoms not the cause.

mike
User avatar
clarf
Posts: 613
Joined: Wed 13 Jun 2007, 19:22
Location: The old Lone Wolf

#6 Post by clarf »

Never tested this with Puppy,

Create a new user to launch the desired application and the set some limits could be a good option, help link:

http://linuxpoison.blogspot.com/2009/01 ... users.html

Greetings,
clarf
DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

#7 Post by DMcCunney »

clarf wrote:Never tested this with Puppy,

Create a new user to launch the desired application and the set some limits could be a good option, help link:

http://linuxpoison.blogspot.com/2009/01 ... users.html
Unless you are using Pizzasgood's multi-user Puppy, you'll have a problem. Puppy is explicitly a singe-user system, and you are always running as root. I don't think you can create a user to launch the desired application.

It's an interesting idea, however. I'm not sure anyone has played with ulimit in Puppy.
______
Dennis
Post Reply