Re: MALLOC

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 05/30/04


Date: Sat, 29 May 2004 22:29:07 -0400

First, dream on. The chances that you will be able to allocate 1GB of memory is
vanishingly small, even if you call VirtualAlloc.

Physical RAM size has nothing to do with the ability to allocate the memory. You need a
swapfile of a minimum of 1GB, and I would suggest 1.5GB to 2GB But you need a whopping lot
of main memory to get respectable performance.because if memory is low, you spend all your
time swapping pages in and out.

Why do you need 1GB? There are often better alternatives to such massive allocations. For
example memory-mapped files where you map a view to pieces of the file.

But while you see 2GB of virtual address space, a lot of that is already committed to
various DLLs, your heap, etc., and finding 1GB of contiguous heap is very low probability.
On end-user machines, you can assume the probability is zero.

You are more likely to be able to allocate two 0.5GB chunks, or 10 100MB chunks.

If you're seriious about needing this much memory, buy an AMD64 box, which has an 8TB user
address space.
                                        joe

On Sat, 29 May 2004 07:41:03 -0700, "VIJAY" <anonymous@discussions.microsoft.com> wrote:

>I need to allocate 1 gb of data in memory.( ram).. how do i do this??
>but if the physical ram size is small and how the data is loaded..
>any suggestion will be appreciated..
> VIJAY

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: Is there a maximum contiguous memory allocation?
    ... Most of it would be paged out most of the time, but could ALLOCATE it! ... allocate it if I had 2GB of physical memory! ... the amount of physical memory I have installed. ... Note that you can use raw VirtualAlloc to improve your ...
    (microsoft.public.vc.mfc)
  • Re: Is there a maximum contiguous memory allocation?
    ... but could ALLOCATE it! ... allocate it if I had 2GB of physical memory! ... the amount of physical memory I have installed. ... Note that you can use raw VirtualAlloc to improve your ...
    (microsoft.public.vc.mfc)
  • Re: VirtualAlloc()
    ... large/global memory usage instead of "new". ... allocate physical storage. ... uses `VirtualAlloc'. ...
    (microsoft.public.vc.language)
  • Re: Application becomes slow in windows server 2003
    ... Memory allocation is not your bottleneck. ... I asked the difference between heapalloc and virtualalloc because of my ... Since calloc,malloc call heapalloc so i thought to use it directly. ... assumption was it will improve performance(time to allocate memory). ...
    (microsoft.public.vc.mfc)
  • Re: Games made with BBC BASIC for Windows
    ... Memory handling, string handling and data structures are part of BBC ... allocate 256 Mbytes of contiguous virtual address space (actual memory ... used is of course typically very much less) but for some reason Wine ... options of VirtualAlloc, presumably because of some limitation in ...
    (comp.sys.acorn.misc)