Re: Memory Management Tools



some too. Be careful though many 'memory management' products are
really virtual memory management.

Jeff is only too right on this.

One area where real optimization actually is possible is DLL rebasing.
It is relatively simple to explain: Multiple processes can and do
share DLLs. DLL sharing is implemented by mapping the pages of
physical memory into the virtual memory of each application. But what
happens if one process needs to write to a DLL? Obviously it is not
viable to modify the DLL for all processes. Instead Windows uses a
rather neat technique called copy-on-write: only the memory pages
written to are copied in the memory of the process making the
modification. This causes the corresponding pages to be present in RAM
twice.

So when is a DLL being written to? Should it not be static?

Well, the Windows loader, which loads the DLL into memory (which in
fact is rather a mapping than a loading operation) tries to load each
DLL at its base address, which is hard-coded into the DLL and set at
compile-time. If the memory at a DLLs base address is already occupied
by another DLL, the loader has to rebase the DLL. That means changing
a lot of addresses throughout the DLL, aka writing to the DLL memory.
That is when Windows does its copy-on-write trick which leads to
higher memory usage especially on terminal servers, where multiple
users use the same apps with the same DLLs.

What can you do?

There are products that minimize DLL rebasing by optimizing DLL base
addresses. One I personally know is RTO TScale:

http://www.rtosoft.com/Products/TScale/TScale.htm

It is built into Citrix Presentation Server 4+, but can be bought from
RTO, too.

Douglas Brown has published an excellent podcast with RTOs Kevin
Goodman, who explains much about the whole process:

http://www.dabcc.com/podcastdetail.aspx?id=2


If you want to take another route: consider moving to Windows x64 with
more RAM instead of buying software. Might even be cheaper ;-)

I hope this helps.

Helge

.



Relevant Pages

  • Re: writing overlays with VB6
    ... memory assigned to the process. ... Windows design guide lines - which have partly been enumerated here (refer ... Unloading a DLL only tells Windows that it is no longer needed by your ... ActiveX DLL (VB itself has nothing to do with loading or unloading of the ...
    (microsoft.public.vb.winapi)
  • Re: exporting global variables from dynamically linked libraries
    ... Although the code is in common memory, it may be mapped to different ... If you're after shared memory (like the DLL memory in 16-bit Windows ...
    (comp.os.linux.development.apps)
  • Re: VB and dlls
    ... I have a question regarding how VB calls dll files and loads/unloads them ... 10 minutes) some of these dll's unload. ... Objects are closed under the sole control of Windows. ... Windows holds objects in memory in case they need to be used again. ...
    (microsoft.public.vb.general.discussion)
  • Re: Why do we need executables in certain formats ?
    ... > complex binary formats was that programs need to be relocated, ... > perhaps linked with libraries. ... Modern virtual memory processors can locate to ... > has a hidden problem with the new .DLL. ...
    (comp.lang.asm.x86)
  • Re: Why is Base3.exe using 700+ K in windows task manager ?
    ... DLL function. ... handles opened by any thread of the calling process ... The DLL allocates memory from the virtual address space of the calling ... Who can tell where memory is really located in a virtual adress space? ...
    (alt.lang.asm)