Re: malloc on 64 AMD64
Sebastian Haase <haase@msg.ucsf.edu> writes:
> 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:
A crash ;-)
> <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>
because you ignored this warning:
> test64.c: In function `main':
> test64.c:5: warning: assignment makes pointer from integer without a cast
If you fix the code (#include <stdlib.h>), you can allocate more
memory than on x86.
Juergen
--
Juergen Kreileder, Blackdown Java-Linux Team
http://www.blackdown.org/java-linux/java2-status/
Reply to: