Re: Compiler options and memory overheads

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Sat, 25 Jun 2005 14:44:29 -0700, "Alexander Grigoriev"
<alegr@xxxxxxxxxxxxx> wrote:

>If you allocate tens of megabytes, you better use an allocator based on
>VirtualAlloc, not HeapAlloc. The default heap won't grow over some limit.

True, but I would say hundreds of megabytes.

>Using memory-mapped files as memory is a waste of time, unless you want to
>guarantee you will never run out of swap space.

Exactly. This reduces support calls, and has the additional benefit of
not causing the stupid default Windows page file to extend on large
allocations. The time required to memory-map a file is minimal, and
paging from the memory-mapped file is not measurably slower than from
the page file.

Another reason is that users with a "little knowledge" about memory
complain when a program uses a lot of page file space, even when they
are working on 500 MB images. By using memory-mapped files for the
virtual memory, this again reduces support calls and complaints.

As a small company with a large customer base, it's often better for
us to prevent the support reports rather than have to educate the
customers about Windows internals.

"Let Windows manage my page file" (or whatever its name is now) is a
very poor default setting, which affects system performance when the
page file must be extended and especially when it gets fragmented.

>"Severian [MVP]" <severian@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>news:s03qb1p2b2ep34mc3j6rribcsu864obknd@xxxxxxxxxx
>>
>> ...Unless you're frequently allocating large amounts of memory (>100
>> MB for example); then it's quite useful to use separate heaps -- and
>> compact them -- or even memory-mapped files (to avoid excessive page
>> file use).
>>
>> Low-fragmentation heaps can be helpful in some situations, on the
>> later O/Ses that support them.
>>
>> --
>> Phillip Crews aka Severian
>> Microsoft MVP, Windows SDK
>> Posting email address is real, but please post replies on the newsgroup.
>

--
Phillip Crews aka Severian
Microsoft MVP, Windows SDK
Posting email address is real, but please post replies on the newsgroup.
.



Relevant Pages

  • [BUG] commit 3c517a61, slab: better fallback allocation behavior
    ... Currently we simply attempt to allocate from all allowed nodes using ... memory may still be available if we would perform more thorough reclaim. ... This avoids slab fragmentation by first getting rid of all partial ... # ACPI Support ...
    (Linux-Kernel)
  • Re: benefit of /PAE switch on Windows XP
    ... that still support No-Execute ... Now we want to find a solution to give as much memory as ... Are you saying with /PAE switch, each process can enjoy 4GB of user memory ... Will windows need at least 1GB of virtual address space. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: non-paged memory inside a kernel driver
    ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ... With their stuff running I cannot allocate 10 MB 's on a XP system. ... so I need 100MB of non-paged memory inside my driver. ...
    (microsoft.public.development.device.drivers)
  • Re: Ranting about JVMs default memory limits...
    ... Originally, 32-bit Windows split it half and half, with the user code getting 2GB and the OS getting 2GB. ... But, the OS didn't really need 2GB of address space, and so enabling "LARGEADDRESSAWARE" tells the OS that the application doesn't make any assumptions about the range of pointers and that it can pass user data addresses to the process in the first 1GB of the second 2GB of the full 4GB address space. ... Memory blocks aren't moveable, so allocations can sit in between two free blocks, limiting the size of the largest block that can actually be allocated. ... Depending on the allocation pattern, it's not hard at all to have over 1GB of virtual address space left, but not be able to allocate any single block nearly that large. ...
    (comp.lang.java.programmer)
  • Re: 4GB of RAM tunning in windows xp professional xp sp2 with 32bi
    ... Windows 2000 Advanced Server and Windows 2000 Datacenter Server support the use of this switch and respectively support memory limits of 8GB and 32GB with the use of the switch. ...
    (microsoft.public.windowsxp.general)