开发者

Run a program under certain amount of physical memory?

开发者 https://www.devze.com 2022-12-16 20:49 出处:网络
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

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!


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.


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.


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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号