Yang Bo
Yang Bo

Reputation: 669

Run a program under certain amount of physical memory?

I want to install qt in my Dreamhost Linux host. As you know, any hosting service will limit its users resource such as CPU and memory. When linking QT, it will cause the ld linker more than 400M memory, and then it get killed by the process monitor of Dreamhost... I try to google for hours without finding any real answer for my problem. I am searching for Linux command utility which can run a program under certain amount of physical memory. I mean, I can run it as:

 memory-limit  -m 200M  ld ld-args ... 

And then, ld will run under 200M physical memory, but this does not mean ld can't allocate more than 200M. When ld allocate more than 200M, the physical memory will not increase, and it will use swap disk. And the RES part of ld's memory will not exceed 200M...

I know, the feature I need sounds like a virtual machine, I am wondering whether KVM can provide such feature. I am really wondering whether there is such a tool... :) Please help if you know something about this.

Thanks!

Upvotes: 2

Views: 444

Answers (4)

Hasturkun
Hasturkun

Reputation: 36412

Not entirely an answer to your question, but you can try running ld with these options set, which may improve its chances of survival:

  • --no-keep-memory
  • --reduce-memory-overheads

Upvotes: 0

Artyom
Artyom

Reputation: 31273

Have you tryed to reduce dependencies? I assume you do not use GUI at all for web applications, maybe you need only QtCore shared library that should be significantly smaller.

By default qmake links with QtGUI.

Upvotes: 0

Andrew McGregor
Andrew McGregor

Reputation: 34642

Add some swap space; Linux can swap on a file, so if you can create a few gigabytes of swap file, that will get the linking done.

However, you really ought to be able to get a binary package for Dreamlinux and just install it, rather than trying to compile QT there.

Upvotes: 1

Kim Stebel
Kim Stebel

Reputation: 42047

If this is just about compiling QT, the easiest solution is to compile it somewhere else (a virtual machine with the same OS and arch maybe?) and then just copy the binaries.

Upvotes: 0

Related Questions