Re: Limit RAM used by a perl script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



From: Sean Carolan <scarolan@xxxxxxxxx>
> > First, install the perl module BSD::Resource
> >
> >   yum install perl-BSD-Resource
> >
> > Then use it in your program like:
> >
> >   #!/usr/bin/perl
> >
> >   use BSD::Resource;
> >   setrlimit(RLIMIT_VMEM, 1_000_000, 1_000_000);
> >
> >   # rest of the program that is limited to 1MByte now
> 
> Thanks, Paul.  I knew I'd find an answer if I posted my question here.

While having hard limits makes it safer, wouldn't it be better to control the memory usage of the script instead of setting limits that would trigger an "out of memory"...?

JD


      

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux