Recently i am testing an equipment that runs in i586 fedora linux. I have to test mmap function. For that i determined to fill the memory and run the required application to check whether it throws any mmap error regarding low resources.
This is the line that does the allocation.
p = (long double *) malloc(BUFFSIZE);
In windows process explorer i have noticed that what ever value we give it to BUFFSIZE it will increase the size of "Private Bytes" but not working set memory or actual memory. In linux the memory still remains the same even after allocating about 1000MB. So the system remains stable. The "memset" package is not available and cannot be installed, also there is no swap memory. The equipment runs in its own ram which is about 500MB.
I am looking for a C program to fill the memory and crash the system. Kindly help.
Recently i am testing an equipment that runs in i586 fedora linux. I have to test mmap function. For that i determined to fill the memory and run the required application to check whether it throws any mmap error regarding low resources.
This is the line that does the allocation.
p = (long double *) malloc(BUFFSIZE);
In windows process explorer i have noticed that what ever value we give it to BUFFSIZE it will increase the size of "Private Bytes" but not working set memory or actual memory. In linux the memory still remains the same even after allocating about 1000MB.
Linux will show memory that is malloced but never used in any way under its' virtual memory stat.
If you want the system to actually run out of memory, and not kill random processes to regain it, you may want to turn overcommit and oom-kill off on your linux system. With overcommit enabled, it will only allocate memory you actually use. I cannot predict the effects of this on a system completely lacking in swap memory however -- why does your system not have it? Was Windows tested under these conditions too?
These settings are not persistent. If you reboot the machine, they will be set back to default values. Which are frankly more stable for reasons you're discovering -- it makes it harder for endless memory leaks to kill your machine. Not all versions of linux have /proc/sys/vm/oom-kill, I'm hunting for the alternative. You may find it listed by sysctl -A.
Quote:
The "memset" package is not available and cannot be installed
What memset package? If you mean the C function, it definitely has memset. You need to include <string.h>.
Last edited by Corona688; 12-14-2009 at 01:48 PM..
Thanks a lot for the help. It gave me a start (keywords for googling )...given below is the code for filling the memory in linux ....yes the swap is unavailable. The vendor installed it that way.
Glad you found what you needed, but please put that code in code tags..
Also, I see nothing in there that needs C++ libraries or even a C++ compiler, it'll compile as pure C.
Quote:
Originally Posted by frozensmilz
yes the swap is unavailable. The vendor installed it that way.
So install it. If you're concerned about low-memory, you need swap. You don't even need a partition to add swap, you can just make a big empty file, run mkswap on it, and mount it as swap.
Hi all, bit of a forum newb here, so apologies if this has been covered else where, but I wonder if any of you has any experience with stress testing servers, specifically using 3rd party services. We run a very busy production system, and just haven't been able to simulate the user activity while... (1 Reply)
I am facing a problem of memory corruption. The loop runs for the first time but does not go through the second time. What could be the problem?
for(int z=0;z<2;z++)
{
fp=fopen("poly.dat","r");
/*do something which reads this file into a 2D array*/
fclose(fp);
... (10 Replies)
I am using libxml2 library for XMl parsing and libxml++ is C++ wrapper over that. So I am using API of libxml++. I am creating my class and composing instance xmlpp::Node *pNode in that. my class also have funciton prepareXPathQuery() which creates query string and have other fucntion... (2 Replies)
Hi All,
I have a simple code which does some computation by matching string patterns.
In brief:
1. The code reads .dat and .txt files.
2. .dat files are huge text files and .txt files contain some important words.
3. I am just doing strstr to find the patterns.
4. The function returns the... (3 Replies)
Hi,
Your great help is very appreciated. I am looking for any Unix command or tool for doing Stress/Load test of php files at command prompt.
I tried torture.pl but it is not working after20 concurrent threads/users.
as it is very urgent for me..please suggest ur ideas asap.
thanks (5 Replies)
In a 'C' program,when I am trying to allocate memory with the help of malloc () function, it is allocating the memory up to a certain limit for e.g. in my case, it is 670 MB (approx). malloc() returns NULL if I allocate more than this amount of memory.When I tried
to allocate memory in chunks of... (1 Reply)
Actually for a process to run it needs text, stack , heap and data segments. All these find a place in the physical memory.
Out of these 4 only heap does exist after the termination of the process that created it. I want to know the exact reason why this happens. Also why the other process need to... (20 Replies)
I'm looking for a script or some other application that will use up a lot of memory on a Solaris or Linux server, in order to test a monitoring application. So far I have found a script that's good for CPU usage but it does nothing for memory. I have also tried the application called 'stress'... (0 Replies)
When allocating memory for two different nodes, the resulting memory are the same. Clearly, this will lead to a mistake. This happened in a function. And the process must be in a function.
(gdb) p tree->list
$43 = (node *) 0x8be4180
(gdb) p tree->list
$44 = (node *) 0x8be4180
At the... (2 Replies)