Results 1 to 7 of 7

Thread: How to limit memory usage by an application

  1. #1
    Join Date
    Jun 2006
    Beans
    Hidden!

    How to limit memory usage by an application

    Hi,

    I am using meld to compare large folders and this drives to my computer freezing. The problem is meld is filling all my computer memory (RAM+swap) slowing it down to a point it takes a few minutes before the mouse movements happen on the screen.

    How can I set a maximum memory usage value for an application?
    My second question is why would ubuntu let an app behave in a manner that makes the OS unusable?? (that behaviour feels Microsoftish!)

    Thanks for your help!

    Mlok

  2. #2
    Join Date
    Feb 2006
    Location
    St. Louis, Missouri, USA
    Beans
    87
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: How to limit memory usage by an application

    You can try using the `nice` command to make an application lower its priority, but I know of know way to place an actual cap on a specific process or application.
    Any technology distinguishable from magic is insufficiently advanced.
    - Cleon, Foundation's Fear
    Linux user #143407 - Ubuntu user #14010

  3. #3
    Join Date
    Jun 2006
    Beans
    Hidden!

    Re: How to limit memory usage by an application

    Thanks for your help but the 'nice' command has no consequence on memory usage, it plays a role on CPU usage (that was my first thought and I tried it but then understood it was a memory issue).

    The goal here is to prevent one application to fill up the memory and paralyze the whole system.

  4. #4
    Join Date
    Nov 2007
    Beans
    Hidden!
    Distro
    Ubuntu Karmic Koala (testing)

    Re: How to limit memory usage by an application

    Hi,

    Just been looking into this myself.

    It seems the tool to use is ulimit (man 1 bash).

    Limits can be placed on users or shells, but not specific processes..

    You'll have to start a Terminal, set limits with ulimit, then run your process from that same Terminal.

    Or as suggested to me on IRC (Cheers Dr_Willis!), write a small bash script to set ulimit and run your application.

    HTH

    zer0x

  5. #5
    Join Date
    Jun 2006
    Beans
    Hidden!

    Re: How to limit memory usage by an application

    Thanks zer0x I'll try this workaround asap!

  6. #6
    Join Date
    Feb 2006
    Location
    St. Louis, Missouri, USA
    Beans
    87
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: How to limit memory usage by an application

    Learn something new everyday.
    Any technology distinguishable from magic is insufficiently advanced.
    - Cleon, Foundation's Fear
    Linux user #143407 - Ubuntu user #14010

  7. #7
    Join Date
    Nov 2006
    Location
    Germany
    Beans
    852
    Distro
    Kubuntu 10.10 Maverick Meerkat

    Re: How to limit memory usage by an application

    How can I set a maximum memory usage value for an application?
    My second question is why would ubuntu let an app behave in a manner that makes the OS unusable?? (that behaviour feels Microsoftish!)
    you may use the package cpulimit to limit the cpu usage of a process
    watch out where the huskies go
    and don't you eat that yellow snow (Zappa)

    http://www.youtube.com/watch?v=YGZ5isu23ow
    http://www.youtube.com/watch?v=xPsnLUaXyxE

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •