Question

Good day!

I have a perl script, that consome a lot of memory ( 3-4 Gb ). Can I get that script to use only swap memory? ( I use ubuntu )

Thanks.

Was it helpful?

Solution

You might be able to increase the "swappiness" of your processes using cgroups - See: Documentation/cgroups/cgroups.txt. cgroups are control groups, via which you can give families of related processes specific characteristics. Section 1.6 of that document shows how to set up such a group.

Having established a cgroup you can set it's swappiness (ie. how soon the kernel will start swapping it relative to other processes in the system). See: Documentation/cgroups/memory.txt.

Disclaimer: I have not had occasion to use this function yet so the above is from glancing through these documents. You'd better read them carefully before you try to use them!

OTHER TIPS

If your script consumes a lot of memory and doesn't fit into physical memory, you need a disk swap. If disk swap is not what you what you may turn it off using swapoff. But if you do this, then your script will simply fail if it attempts to allocate more memory than physically available. I'd suggest to optimize script memory consumption.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top