Sponsored Content
Top Forums Programming Stress testing memory using malloc in linux ?? Post 302380168 by Corona688 on Monday 14th of December 2009 12:22:59 PM
Old 12-14-2009
Quote:
Originally Posted by frozensmilz
Hi to all,

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?

Code:
echo 2 > /proc/sys/vm/overcommit_memory
echo 0 > /proc/sys/vm/oom-kill

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..
 

10 More Discussions You Might Find Interesting

1. Programming

malloc gives the same memory to two different nodes. How to deal with it?

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)
Discussion started by: cdbug
2 Replies

2. Solaris

how to stress the memory

Hi All, Is there way to stress memory on Solaris 10? If yes, how do I monitor the memory usage? (3 Replies)
Discussion started by: samnyc
3 Replies

3. UNIX and Linux Applications

Solaris & Linux memory stress test?

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)
Discussion started by: Kraas
0 Replies

4. Programming

Why memory allocated through malloc should be freed ?

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)
Discussion started by: karthiktceit
20 Replies

5. Programming

Regarding the maximum memory allocated by malloc() function on HP-UX B11.11

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)
Discussion started by: vipinsachan
1 Replies

6. Shell Programming and Scripting

Stress testing php files at Unix/Linux Command line

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)
Discussion started by: Malleswari
5 Replies

7. Programming

./match_pattern.out: malloc(): memory corruption: 0x0000000013a11600 ***

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)
Discussion started by: shoaibjameel123
3 Replies

8. Programming

glib detected: malloc() memory curruption

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)
Discussion started by: sharadwagh
2 Replies

9. Programming

*** glibc detected *** ./a.out malloc() memory corruption

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)
Discussion started by: dare
10 Replies

10. UNIX for Beginners Questions & Answers

3rd party stress testing services

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)
Discussion started by: dare99
1 Replies
MALLOC_STATS(3) 					     Linux Programmer's Manual						   MALLOC_STATS(3)

NAME
malloc_stats - print memory allocation statistics SYNOPSIS
#include <malloc.h> void malloc_stats(void); DESCRIPTION
The malloc_stats() function prints (on standard error) statistics about memory allocated by malloc(3) and related functions. For each arena (allocation area), this function prints the total amount of memory allocated and the total number of bytes consumed by in-use alloca- tions. (These two values correspond to the arena and uordblks fields retrieved by mallinfo(3).) In addition, the function prints the sum of these two statistics for all arenas, and the maximum number of blocks and bytes that were ever simultaneously allocated using mmap(2). CONFORMING TO
This function is a GNU extension. NOTES
More detailed information about memory allocations in the main arena can be obtained using mallinfo(3). SEE ALSO
mmap(2), mallinfo(3), malloc(3), malloc_info(3), mallopt(3) Linux 2012-05-06 MALLOC_STATS(3)
All times are GMT -4. The time now is 08:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy