LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-13-2013, 08:35 PM   #1
tfnc99
Member
 
Registered: Sep 2012
Posts: 58

Rep: Reputation: Disabled
Can I run test my program with less memory then I have?


OK so I have been wanting to test some of my programs to see how well they can handle running in low memory situations and
such, and VM, allocating a lot of memory at start, etc. Seem unreliable, are there any tools to do this? Can I do this with
gdb?

I am using plain c with gcc. I am on ARM if that matters. Debian Wheezy

Last edited by tfnc99; 04-13-2013 at 08:38 PM.
 
Old 04-13-2013, 09:29 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,153

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
Not sure if this what you are looking for (or if it applies to ARM, although I reckon it should), but you can limit the memory the kernel "sees" at boot. see here.
 
Old 04-14-2013, 05:18 AM   #3
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Or perhaps run it on a virtual environment like VirtualBox.
 
Old 04-14-2013, 05:54 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
You could also try ulimit -v <size_in_KB> before running the program
 
1 members found this post helpful.
Old 04-14-2013, 02:36 PM   #5
tfnc99
Member
 
Registered: Sep 2012
Posts: 58

Original Poster
Rep: Reputation: Disabled
Is there a way to tell how much memory the system is using idling? So I know what to set ulimit to.
Also does ulimit take swap into account?
 
Old 04-14-2013, 07:58 PM   #6
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
Quote:
Originally Posted by tfnc99 View Post
Is there a way to tell how much memory the system is using idling? So I know what to set ulimit to.
Also does ulimit take swap into account?
Just run top and estimate I guess. If there's enough memory why would it?
 
Old 04-15-2013, 02:54 AM   #7
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,880
Blog Entries: 1

Rep: Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871Reputation: 1871
> So I know what to set ulimit to.

Just try different values, and you will find out how much is required to run your program.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
*** Could not run GTK+ test program, checking why... norskkriger Linux - Newbie 2 04-26-2008 11:15 PM
How to test a run-time of a C program frankie_DJ Programming 2 10-07-2006 04:03 AM
KDE g++ program doesn't run test.cpp richikiki Programming 6 03-17-2006 02:47 PM
Memory Leak when using memory debugging C program on SuSE SLES8 babalina Linux - Distributions 0 10-06-2003 09:39 AM
compiling kino, gtk test program cant run vance Linux - Software 1 06-02-2003 04:36 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration