[Pw_forum] Error encountered while attempting to allocate a d ata object.

Serguei Patchkovskii ps at ned.sims.nrc.ca
Thu Jan 29 03:37:24 CET 2004


On Wed, 28 Jan 2004, Konstantin Kudin wrote:
>  Regarding Intel compiler, what is the default size of
> the memory (i.e. without extra flags) there? Is it up
> to 1Gb, or something smaller?

That depends on the compiler options, kernel, the C library, and
any other libraries linked in. At least some 2.4-series kernels
also contain a bug in memory management routines, which may make
the maximum memory size decrease with time.

I usually end up running a little test program (attached) every
time I am not entirely sure. E.g.:

Linux 2.4.10 (1GB); glibc 2.2.4; ifc -FR :

 BSS is around    807DDF8 (   128.492 Mb)
 stack is around   BFFFF620 ( -1024.002 Mb)
 Max array size =   2036.000 mbyte
 Last array was at   409A2040 (  1033.633 Mb)
 Max second array size =      0.000 mbyte
 Last second array was at   409A2040 (  1033.633 Mb)

Linux 2.4.18 (0.5GB); glibc 2.2.5; ifc -FR :

 BSS is around    807DD9C (   128.492 Mb)
 stack is around   DFFFF410 (  -512.003 Mb)
 Max array size =   2044.000 mbyte
 Last array was at    EAA8040 (   234.656 Mb)
 Max second array size =   1304.000 mbyte
 Last second array was at ********** ( -1817.340 Mb)

Linux(x86_64) 2.4.19; glibc 2.3.2; ifc -FR:

 BSS is around    807DDBC (   128.492 Mb)
 stack is around   FFFFD280 (    -0.011 Mb)
 Max array size =   2044.000 mbyte
 Last array was at   40AC7040 (  1034.777 Mb)
 Max second array size =   1016.000 mbyte
 Last second array was at ********** ( -1017.219 Mb)

Linux(x86_64) 2.4.19; glibc 2.3.2; pfg90 -Mfree (32-bit) :

 BSS is around    8067188 (     0.000 Mb)
 stack is around    806EFC8 (     0.000 Mb)
 Max array size =   3068.000 mbyte
 Last array was at   401A1010 (  1025.629 Mb)
 Max second array size =    892.000 mbyte
 Last second array was at    8073950 (   128.451 Mb)

As you can see, the results can be quite variable :-0)

Cheers,

Serguei

---
Dr. Serguei Patchkovskii

Tel: +1-(613)-990-0945
Fax: +1-(613)-947-2838
E-mail: Serguei.Patchkovskii at nrc.ca

Coordinator of Modelling Software
Theory and Computation Group
Steacie Institute for Molecular Sciences
National Research Council Canada
Room 2011, 100 Sussex Drive
Ottawa, Ontario
K1A 0R6 Canada

-------------- next part --------------
  program mem
     implicit none
     integer, parameter   :: inc = 1024*1024
     integer, allocatable :: ary(:), ary1(:), ary2(:)
     integer              :: size, status
     integer*8            :: addr
     logical              :: failed
     integer, save        :: static = 1

     write (6,"(' BSS is around ',z10,' (',f10.3,' Mb)')") &
           loc(static), loc(static)/(1024d0**2)
     write (6,"(' stack is around ',z10,' (',f10.3,' Mb)')") &
           loc(failed), loc(failed)/(1024d0**2)

     failed = .false.
     size   = 0
     do while (.not.failed)
        size = size + inc
        status = 0
        allocate (ary(size),stat=status)
        if (status/=0) then
           failed = .true.
        else 
           addr   = loc(ary)
           deallocate (ary)
        end if
     end do

     write (6,"(' Max array size = ',f10.3,' mbyte')") &
           ((0d0+size-inc)*bit_size(ary))/8d0/(1024d0**2)
     write (6,"(' Last array was at ',z10,' (',f10.3,' Mb)')") &
           addr, addr/(1024d0**2)

     allocate (ary1(size-inc))

     failed = .false.
     size   = 0
     do while (.not.failed)
        size = size + inc
        status = 0
        allocate (ary(size),stat=status)
        if (status/=0) then
           failed = .true.
        else 
           addr   = loc(ary)
           deallocate (ary)
        end if
     end do

     write (6,"(' Max second array size = ',f10.3,' mbyte')") &
           ((0d0+size-inc)*bit_size(ary))/8d0/(1024d0**2)
     write (6,"(' Last second array was at ',z10,' (',f10.3,' Mb)')") &
           addr, addr/(1024d0**2)

     allocate (ary2(size-inc))

     pause

  end program mem


More information about the users mailing list