How to overload memory?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to overload memory?
# 1  
Old 08-08-2006
How to overload memory?

Hi,

I need to intentianlly use up memory. Smilie We have a product fix that that resolves an issue that only arrises when the system is under extreme load.

We have a SunOS, 5.8 test machine but have not been able to run enough data through to replicate the original issue and test the patch.


Any ideas?

Many thanks,

Neil
# 2  
Old 08-08-2006
would you just be able to write a small c program to malloc() that much memory... would that work? im not too sure tho.
# 3  
Old 08-08-2006
I agree with _R3d , something like this might work:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

#define SIZE 1024 * 1024
main( int argc, char *argv[] )
{

  while(1) {
    void *ptr;
    fork();
    ptr =  malloc( SIZE );
    printf("addr = %X\n" , ptr);
  }


  return 0;
}

# 4  
Old 08-08-2006
Nathan -

that will flood the system until the process limit for the user or the system process limit is hit.
Are you sure you wanna do that?
# 5  
Old 08-09-2006
No, actually I'm not sure. In fact, I wouldn't recommend doing this, but it _will_ use up memory. It's probably best to remove the fork() call, and maybe limit it ( don't use an infinite loop ).

Code:
  int i = 0;

  while(i < 200) {
    void *ptr;
    /* fork(); */
    ptr =  malloc( SIZE );
    printf("addr = %X\n" , ptr);
    i++;
  }

Even when I use an infinite loop (without the fork), I run out of memory pretty fast. ( Not sure why - my system should have a lot more available. I will assume there's a limit to how much memory can be allocated to a single process. )

addr = BFAC4008
addr = BFBC5008
addr = BFCC6008
addr = BFEA6008
addr = 0
addr = 0
addr = 0
# 6  
Old 08-09-2006
Another way would be to build something huge with lots of simultaneous jobs.
# 7  
Old 08-10-2006
Or mmap a few giant files....

rather than hack around consider going http://www.sourceforge.net
and look for stress test software. Or. I'm not a Sun person, but vendors often have this type of software available usually free. Check and see.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Solaris

[DOUBT] Memory high in idle process on Solaris 10 (Memory Utilization > 90%)

Hi Experts, Our servers running Solaris 10 with SAP Application. The memory utilization always >90%, but the process on SAP is too less even nothing. Why memory utilization on solaris always looks high? I have statement about memory on solaris, is this true: Memory in solaris is used for... (4 Replies)
Discussion started by: edydsuranta
4 Replies

2. UNIX for Advanced & Expert Users

overload

Hi Friends, we are using RHEL4.2 (Redhat Enterprise Linux ) .My problems is when more more than 51st logs in it is not allowing.It allows only 50 users to log in i.e one user logs-in in 4 to 6 different virtual windows using f1 to f6 , if I kill the older one sometime the file which the... (1 Reply)
Discussion started by: vakharia Mahesh
1 Replies

3. Programming

How to deal with lots of data in memory in order not to run out of memory

Hi, I'm trying to learn how to manage memory when I have to deal with lots of data. Basically I'm indexing a huge file (5GB, but it can be bigger), by creating tables that holds offset <-> startOfSomeData information. Currently I'm mapping the whole file at once (yep!) but of course the... (1 Reply)
Discussion started by: emitrax
1 Replies

4. Solaris

How to find Total and Free Physical Memory and Logical Memory in SOLARIS 9

Hi, Im working on Solaris 9 on SPARC-32 bit running on an Ultra-80, and I have to find out the following:- 1. Total Physical Memory in the system(total RAM). 2. Available Physical Memory(i.e. RAM Usage) 3. Total (Logical) Memory in the system 4. Available (Logical) Memory. I know... (4 Replies)
Discussion started by: 0ktalmagik
4 Replies

5. Linux

dnssubmit queue overload error message

my squid running on openBSD 4.1 i have dns_childern 32 but i m facing a problem of queue overloading cache.log shows this error message... dnsSubmit: queue overload, rejecting xxxxxxxxxx dnsSubmit: queue overload, rejecting xxxxxxxxxx dnsSubmit: queue overload, rejecting xxxxxxxxxx... (0 Replies)
Discussion started by: anil.pilani
0 Replies
Login or Register to Ask a Question