[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

malloc on 64 AMD64



Hi,
We are planning to by an Athlon64 (or Opteron) system and since I like debian 
I am posting this "request":
What output can I expect from this c program:
<code>
#include <stdio.h>
int main()  {  size_t n;  void *p;  double gb;
  for(gb=10;gb>.3;gb-=.5) {
	n= 1024L * 1024L * 1024L * gb; 
	p = malloc( n );
	printf("%12lu %4.1lfGb %p\n",n,n/1024./1024./1024.,p);
	free(p); }  return 0;  }
</code>

BTW: I get this on my Pentium 4
<terminal>
haase@baboon:~: make test64 && ./test64
cc     test64.c   -o test64
test64.c: In function `main':
test64.c:5: warning: assignment makes pointer from integer without a cast
  2147483648  2.0Gb (nil)
  1610612736  1.5Gb 0x4013e008
  1073741824  1.0Gb 0x4013e008
   536870912  0.5Gb 0x4013e008
           0  0.0Gb 0x8049720
  3758096384  3.5Gb (nil)
  3221225472  3.0Gb (nil)
  2684354560  2.5Gb (nil)
  2147483648  2.0Gb (nil)
  1610612736  1.5Gb 0x4013e008
  1073741824  1.0Gb 0x4013e008
   536870912  0.5Gb 0x4013e008
           0  0.0Gb 0x8049720
  3758096384  3.5Gb (nil)
  3221225472  3.0Gb (nil)
  2684354560  2.5Gb (nil)
  2147483648  2.0Gb (nil)
  1610612736  1.5Gb 0x4013e008
  1073741824  1.0Gb 0x4013e008
   536870912  0.5Gb 0x4013e008
</terminal>

I would really appreciate I some people could compile it, run it and post the 
result.  
The reason for this exercise is that some people at my work here claim that 
'some' linuxes that claim being 64bit are still not really allowing a given 
program to allocate more than 2 GB memory.

Thanks,
Sebastian Haase



Reply to: