LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-05-2006, 12:15 PM   #1
DanTaylor
Member
 
Registered: Jan 2006
Distribution: Debian Sarge
Posts: 265

Rep: Reputation: 30
Limiting RAM usage in a perl script


Is there any way to limit the percentage of the RAM that a perl script uses? I need to have a script running in the background continuously, and it uses too much RAM.
 
Old 05-05-2006, 01:24 PM   #2
ioerror
Member
 
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 34
I'm not sure if you can limit perl specifically but you can use ulimit to set limits on what resources the shell can use and these limits are inherited by child processes. The -d option limits the size of the data segment, -v limits the size of virtual memory, -s limits the stack size and so on. ulimit is a shell-builtin so see bash's man page for all the options. I believe the values are in multiples of 1K. ulimit -a will print the current limits.

Last edited by ioerror; 05-05-2006 at 01:25 PM.
 
Old 05-05-2006, 02:37 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Only meaningful if running non-root of course.
Shouldn't be an isuue, but ...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Limiting Snort usage logicalfuzz Linux - Software 2 02-11-2006 05:31 AM
Limiting a process CPU usage therandomthing Linux - Software 1 06-07-2005 09:00 PM
limiting page load frequency with a perl cgi script Metroid Programming 0 12-30-2004 10:33 PM
hourly usage and limiting gadekar Linux - Networking 0 08-06-2003 10:52 PM
limiting cpu and memory usage by user process amitkush Linux - Security 2 07-04-2003 12:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration