Re: Windows array allocation problem



Dan Nagle wrote:
Hello,

Roy Lewallen wrote:
Dan Nagle wrote:

IIRC, Windows marks 250 MB at one end, and 100 MB at the other,
as unusable, in order to catch stray C pointers.

Unfortunately, I can't find any reference to this on the web. I've found that the top and bottom 64 kB are reserved, but no mention of larger amounts. Can you point me to a reference where this is explained or discussed?

I seem to have filed my Windows programming books
under "I don't ever want to read these again" so I can't find
the exact reference.

ISTR that it was in the Microsoft Press book about
programming Windows system calls. I used it years ago to help
with the fthreads module. Title was something
like _Advanced Windows Programming_ or close. Also,
it was the edition for WinNT 4 or so.

Sorry not to be more specific.

Thanks, but there must be something wrong with the recollection.

I've just written a program which does nothing except call GlobalMemoryStatus to get the available virtual memory, then allocates an array to that size and in decreasing steps until STAT returns zero. It then checks the available virtual memory immediately after the allocation. The maximum allocation is consistently 146 MB less than the reported available virtual memory. Compiling exactly the same program with Compaq Visual Fortran 6.6 results in allocation to within 55 MB of the reported virtual memory. In both cases, the sum of the array size and the available virtual memory after the allocation exactly equals the available virtual memory before the allocation.

So the phenomenon isn't due only to how Windows handles virtual memory (strictly, I guess, application virtual address space) but how the compiler handles it.

The program won't attempt to allocate near the 2 GB limit unless the machine has a very large amount of RAM, to avoid swapping into and out of system virtual memory. Not too many users have that much, but no problem had been encountered until recently with the present method of determining how much could be allocated. I now see why the problem has just shown up -- I changed from the Compaq compiler to the Intel compiler not long ago. The test shows that even for the simplest program, the Intel compiler doesn't allow allocating as much of the application virtual memory as the Compaq compiler does, at least not to one large array.


Roy Lewallen
.



Relevant Pages

  • Re: Windows array allocation problem
    ... application virtual memory as the Compaq compiler does, ... the allocation and the operating system that determines whether or not ... It shows that the remaining virtual memory is apparently usable, it just can't all be allocated to the first array. ...
    (comp.lang.fortran)
  • Re: Windows array allocation problem
    ... If the required size exceeds the possible size, the program has internal virtual memory management to solve the problem in pieces, storing intermediate pieces on the disk. ... much is available for an actual allocation. ... since the array dimension and the determination of whether to use the virtual memory manager are presently being determined by the calling program and passed in. ...
    (comp.lang.fortran)
  • Re: GC performance - GC fragility
    ... Though the GC heap will look like one before compaction. ... allocation sizes to different "heap blocks", but it can't be IMHO generally be prevented. ... If you only have macro-fragmentation in the virtual memory space, you can operate with limited fragmentation-induced waste in the allocated memory space. ... that's because the concurrent GC can be gotten into a cycle of never ending GC compaction if your allocation rate exceeds or equals the compaction rate, a condition easy to reach when part of your allocated pool is swapped out. ...
    (borland.public.delphi.non-technical)
  • Re: Windows array allocation problem
    ... the Intel compiler doesn't allow allocating as much of the ... application virtual memory as the Compaq compiler does, ... the allocation and the operating system that determines whether or not ...
    (comp.lang.fortran)
  • Re: Windows array allocation problem
    ... By "available virtual memory" I meant the amount that's actually available for use at the moment that the array allocation is made. ... Functions that report the total amount ...
    (comp.lang.fortran)