mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* memory allocation problems
@ 2001-04-06 14:06 majer
  2001-04-06 15:21 ` Andi Kleen
  2001-04-06 16:57 ` Wayne Whitney
  0 siblings, 2 replies; 7+ messages in thread
From: majer @ 2001-04-06 14:06 UTC (permalink / raw)
  To: linux-kernel

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



  Hi. Im hoping someone on here can help me out. I posted something
  similar to this back in June 2000 when I was on the 2.2.X line and
  was waiting to see if 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                          majer@endeca.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: 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
   

[-- Attachment #3: 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);
} 
  


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-04-06 21:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-06 14:06 memory allocation problems majer
2001-04-06 15:21 ` Andi Kleen
2001-04-06 16:57 ` Wayne Whitney
2001-04-06 19:22   ` Mark Hahn
2001-04-06 19:40     ` Wayne Whitney
2001-04-06 20:08       ` Mark Hahn
2001-04-06 21:21       ` Hugh Dickins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®