linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: <majer@endeca.com>
To: linux-mm@kvack.org
Cc: loki@endeca.com
Subject: memory allocation problems
Date: Thu, 5 Apr 2001 13:08:25 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.21.0104051257570.6783-300000@caffeine.ops.endeca.com> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 885 bytes --]


  Hi. Im hoping someone on here can help me out. I posted something
  similar to this back in June 2000 and was hoping the 2.4 kernel
  would provide a fix.

  Essentially, the problem can be summarized to be that on a machine
  with ample ram (2G, 4G, etc), I am unable to malloc a gig if I ask 
  for the memory in small ( <= 128k) chunks. I've enclosed some results 
  and a little program which was put together to demonstrate the problems
  we're having.  All of the failures seem to occur around 930MB.

  I'm more than happy to try any tunings, patches, etc and my 
  time is at your disposal.

  Thanks,

  Karl

----
        Karl Majer                          majerNO@SPAMendeca.com              
        Sr Systems Architect                617 577 7999 xt 251                

 "Think for yourselves and let others enjoy the privilege to do so, too."
						     --Voltaire

[-- Attachment #2: Type: TEXT/PLAIN, Size: 836 bytes --]

#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<errno.h>

unsigned int i,num,bites,total,delay=0;
char **memhog;

int main(int argc,char *argv[]){

  if(argc!=4){
    fprintf(stderr,"usage: %s [# of chunks] [bytes per chunk] [delay in sec]\n",argv[0]);
    return(1);
  } 

  num=atoi(argv[1]);
  bites=atoi(argv[2]);
  delay=atoi(argv[3]);

  memhog=malloc(sizeof(char*) * num); 
  if(!memhog){
    fprintf(stderr,"malloc error %s\n",strerror(errno));  
    exit(1);
  }

  for(i=0;i<num;i++){
    *memhog=malloc(bites);
    if(!*memhog){
      fprintf(stderr,"malloc error %s\n",strerror(errno));  
      exit(1);
    }
    total+=bites;
    printf("#%u (%X) (%X) allocated %u bytes total.\n",i,memhog,*memhog,total);
    memhog++;
    sleep(delay);
  }  

 return(0);
} 
  


[-- Attachment #3: Type: TEXT/PLAIN, Size: 1433 bytes --]

  The fields are: 
  Iteration, Addr of ptr, Addr stored by ptr, alloc'd mem

  size: 4096
  #228852 (401F07D8) (3FFFC948) allocated 937381888 bytes total.
  #228853 (401F07DC) (3FFFD950) allocated 937385984 bytes total.
  malloc error Cannot allocate memory
  
  size: 8192
  #114536 (40180DA8) (3FFF94E8) allocated 938287104 bytes total.
  #114537 (40180DAC) (3FFFB4F0) allocated 938295296 bytes total.
  malloc error Cannot allocate memory
   
  size: 16384
  #57294 (40148F40) (3FFF1818) allocated 938721280 bytes total.
  #57295 (40148F44) (3FFF5820) allocated 938737664 bytes total.
  malloc error Cannot allocate memory
  
  size: 32768
  #28653 (4012CFBC) (3FFE9910) allocated 938934272 bytes total.
  #28654 (4012CFC0) (3FFF1918) allocated 938967040 bytes total.
  malloc error Cannot allocate memory
  
  size: 65536
  #14325 (805797C) (3FFC5958) allocated 938868736 bytes total.
  #14326 (8057980) (3FFD5960) allocated 938934272 bytes total.
  #14327 (8057984) (3FFE5968) allocated 938999808 bytes total.
  malloc error Cannot allocate memory
  
  size: 131072
  #8186 (8051990) (3FF9F980) allocated 1073086464 bytes total.
  #8187 (8051994) (3FFBF988) allocated 1073217536 bytes total.
  malloc error Cannot allocate memory
  
  size: 262144
  #4094 (804D9A0) (37FD39A0) allocated 1073479680 bytes total.
  #4095 (804D9A4) (380139A8) allocated 1073741824 bytes total.
  success
   

             reply	other threads:[~2001-04-05 17:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-05 17:08 majer [this message]
     [not found] <Pine.LNX.4.30.0104061227240.25381-100000@mf1.private>
2001-04-06 21:21 ` Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.21.0104051257570.6783-300000@caffeine.ops.endeca.com \
    --to=majer@endeca.com \
    --cc=linux-mm@kvack.org \
    --cc=loki@endeca.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox