1

I am not properly sure if this a good question but I need to ask anyway. My question: is it possible to limit RAM usage while compiling my C++ application?

I am not asking to reduce RAM usage for application neither malloc etc. techniques. Is there any switch to pass for make limits ram memory usage to say 256 MB? Or am I totally skipping something important?

GingerPlusPlus
  • 5,336
  • 1
  • 29
  • 52
Kunthar
  • 472
  • 1
  • 5
  • 15
  • 1
    You mean how much RAM the compiler is using? Why would you need to do that? Or are you asking something else (if yes, what)? – UnholySheep Nov 06 '16 at 16:34
  • 2
    [Limit memory usage for a single Linux process](http://unix.stackexchange.com/questions/44985/limit-memory-usage-for-a-single-linux-process) – GingerPlusPlus Nov 06 '16 at 16:35
  • 2
    ulimit is the solution, please check it. can you also give us some background about why you need sth like that. – Validus Oculus Nov 06 '16 at 16:39
  • Assuming you have a desktop, you can always cross-compile for the RasPi - building the executable on your much more capable desktop machine. – enhzflep Nov 06 '16 at 17:11
  • Some more background information. Trying to compile actor framework[1] with NanoPi Neo board[2]. Board has 256 MB RAM and get stuck on compiling phase. I've added 512MB swap and it is okay now. I can slowly compile the lib. But, i've started to think is there any option to say g++ to limit RAM usage. I will accept @validus answer with ulimit[3] for now. [1]http://www.actor-framework.org [2] http://www.friendlyarm.com/index.php?route=product/product&product_id=132 [3] https://gcc.gnu.org/ml/fortran/2006-12/msg00424.html – Kunthar Nov 06 '16 at 21:01
  • also i've found that gcc still has some problems to manage memory. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44563 aaannnd i've found quite exact question of mine. http://stackoverflow.com/questions/12964013/reducing-memory-allocation-gcc-command thx everyone for their time o/ – Kunthar Nov 06 '16 at 21:03

0 Answers0