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

Re: malloc on 64 AMD64



Juergen Kreileder wrote:

Sebastian Haase <haase@msg.ucsf.edu> writes:
What output can I expect from this c program:
A crash  ;-)
If you fix the code (#include <stdlib.h>)
With that fix in place, this is the output I get on x86 in pure 32arch:

a64test.c: In function `main':
a64test.c:13: warning: long unsigned int format, size_t arg (arg 2)
a64test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
for GNU/Linux 2.2.0, dynamically linked (uses shared libs), not stripped
 2147483648  2.0Gb (nil)
 1610612736  1.5Gb (nil)
 1073741824  1.0Gb (nil)
  536870912  0.5Gb 0x40300008
          0  0.0Gb 0x40200490
 3758096384  3.5Gb (nil)
 3221225472  3.0Gb (nil)
 2684354560  2.5Gb (nil)
 2147483648  2.0Gb (nil)
 1610612736  1.5Gb (nil)
 1073741824  1.0Gb (nil)
  536870912  0.5Gb 0x40300008
          0  0.0Gb 0x40200490
 3758096384  3.5Gb (nil)
 3221225472  3.0Gb (nil)
 2684354560  2.5Gb (nil)
 2147483648  2.0Gb (nil)
 1610612736  1.5Gb (nil)
 1073741824  1.0Gb (nil)
  536870912  0.5Gb 0x40300008

This is the output I get on x86 in pure 64arch:

a64test: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV),
for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped
10737418240 10.0Gb (nil)
10200547328  9.5Gb (nil)
 9663676416  9.0Gb (nil)
 9126805504  8.5Gb (nil)
 8589934592  8.0Gb (nil)
 8053063680  7.5Gb (nil)
 7516192768  7.0Gb 0x51f5ab1010
 6979321856  6.5Gb 0x51f5ab1010
 6442450944  6.0Gb 0x51f5ab1010
 5905580032  5.5Gb 0x51f5ab1010
 5368709120  5.0Gb 0x51f5ab1010
 4831838208  4.5Gb 0x51f5ab1010
 4294967296  4.0Gb 0x51f5ab1010
 3758096384  3.5Gb 0x51f5ab1010
 3221225472  3.0Gb 0x51f5ab1010
 2684354560  2.5Gb 0x51f5ab1010
 2147483648  2.0Gb 0x51f5ab1010
 1610612736  1.5Gb 0x51f5ab1010
 1073741824  1.0Gb 0x51f5ab1010
  536870912  0.5Gb 0x51f5ab1010

Before your colleagues complain that it only got to 7GB, this is relevant:
$ free
            total       used       free     shared    buffers     cached
Mem:        509028     507316       1712          0       3968     445436
-/+ buffers/cache:      57912     451116
Swap:      7542436          0    7542436

I added another 4GB of swapspace and ran your program again:

a64test: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV),
for GNU/Linux 2.4.0, dynamically linked (uses shared libs), not stripped
10737418240 10.0Gb 0x2a958a7010
10200547328  9.5Gb 0x2a958a7010
 9663676416  9.0Gb 0x2a958a7010
 9126805504  8.5Gb 0x2a958a7010
 8589934592  8.0Gb 0x2a958a7010
 8053063680  7.5Gb 0x2a958a7010
 7516192768  7.0Gb 0x2a958a7010
 6979321856  6.5Gb 0x2a958a7010
 6442450944  6.0Gb 0x2a958a7010
 5905580032  5.5Gb 0x2a958a7010
 5368709120  5.0Gb 0x2a958a7010
 4831838208  4.5Gb 0x2a958a7010
 4294967296  4.0Gb 0x2a958a7010
 3758096384  3.5Gb 0x2a958a7010
 3221225472  3.0Gb 0x2a958a7010
 2684354560  2.5Gb 0x2a958a7010
 2147483648  2.0Gb 0x2a958a7010
 1610612736  1.5Gb 0x2a958a7010
 1073741824  1.0Gb 0x2a958a7010
  536870912  0.5Gb 0x2a958a7010

... hope that helps ...
   Alex.





Reply to: