Re: Memory Limit

Tech-Archive recommends: Speed Up your PC by fixing your registry



mustafa wrote:
:: To be more precise,
:: 1) What is the maximum size of the array that I can create?

It's not a hard limit. It depends on what else your program does.

:: 2) Is Heap or Stack based variable declaration just affects the
:: speed? I mean, is it possible to create the same maximum size
:: array with the stack, just sacrificing the speed?

When we are talking GB sizes, allocation speed isn't an issue because
you can only do one or two allocations. If you allocate hundreds of
millions of small objects, allocation speed will be visible.

It is unlikely that you can allocate GB sizes for the stack, so that's
really not an option.

:: 3) Having 2GB physical memory doesnt mean that you can use all
:: this space, because some part of this memory is already consumed
:: by Operating system by default.

You can use most of it, because most of the OS will swap out to disk
when needed. Your own program, and all supporting DLLs, will consume
parts of the virtual memory. Physical is of less importance.

:: 4) Do I need to use PhysicalMemory defragmentation? If yes what
:: kind of tool I can use for this purpose?

No. Your problem is with virtual memory. On a 32-bit system you just
run out of addresses when dealing with GBs.

:: 5) Why increasing the virtual memory ( = page file ?) to 10-20 GB
:: doesnt help to create bigger arrays?

Because you can only address 2 (or 3) GB per program. Having a larger
page file lets you have several programs each using 2-3 GB.

Check out how many bits you need to count to 3 billion. How many do we
have?

:: 6) Having 10GB virtual memory means that I can create 10GB size
:: array?

On a 64 bit system - yes. On a 32 bit system - no you can't have that
much virtual memory.


Bo Persson


.



Relevant Pages

  • 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)
  • [RFC][PATCH] flexible array implementation v4
    ... I call it a flexible array. ... so never does an order>0 allocation. ... storage for pointers to the second level. ... all locking must be provided by the caller. ...
    (Linux-Kernel)
  • Re: [RFC][PATCH] flexible array implementation v4
    ... I call it a flexible array. ... so never does an order>0 allocation. ... storage for pointers to the second level. ... all locking must be provided by the caller. ...
    (Linux-Kernel)
  • Re: FSL auxiliary files: proposed reorganization of words
    ... For dynamic arrays/matrices which have not been allocated, the value of addr is ambiguous. ... It is the programmer's responsibility to ensure that he/she doesn't attempt to use a dynamic array prior to allocation. ... If the header block structure is allowed to be implementation dependent, then provide an API function which returns the start of the header block. ...
    (comp.lang.forth)
  • [RFC][PATCH] flexible array implementation v3
    ... I call it a flexible array. ... so never does an order>0 allocation. ... storage for pointers to the second level. ... all locking must be provided by the caller. ...
    (Linux-Kernel)