Re: Re-basing packages



Matthew Jones wrote:
I've just got round to trying the SysInternals Process Explorer, and one option it has is to show relocated DLLs. Relocating a DLL is apparently something that will slow loading down. So I checked out my Delphi 7 running exe and pretty much every bpl file is relocated.

Has anyone done any research into how to "re-base" them for efficiency?


Yes.

If dll's/bpl's must be relocated in memory this not only slows
the machine down, it also prevents these relocated dll's to be
shared in physical memory by multiple applications thus wasting
memory.


First of all, you shouldn't re-base any Borland-supplied packages
because (a) the Eula forbids deployment of modified Borland packages
and (b) they have been compiled with correct imagebases anyway.

Apart from that:

The microsoft platform SDK has a nice tool called "rebase.exe" that will do
exactly as you want. It can even do an automatic batch rebase so that all
dll's/bpl's will neatly fit together in memory.

This is how I do it:

- I copy all DLL's and BPL's from the application into one directory,
e.g. d:\mydir.

- I create a text file (mylist.txt) that contains the names of these
DLL's in the sequence in which I want them to fit into memory.

- I write a batch file that calls the rebase utility, specifiying the text
file as an inputfile, and the desired start address:

rebase -b 0x44000000 -e 0x10000 -R "d:\mydir" -G mylist.txt
rebase -s -b 0x44000000 -e 0x10000 -R "d:\mydir" -G filelist.txt >"d:\output.txt"


This will re-base the dll's starting from address $44000000, leaving $10000
bytes free between each DLL (for future growth) and produces a list with
the start addresses so that I can use these to specify the $imagebase in
my source code.







--
Arthur Hoornweg

(In order to reply per e-mail, please just remove the ".net"
from my e-mail address. Leave the rest of the address intact
including the "antispam" part. I had to take this measure to
counteract unsollicited mail.)
.



Relevant Pages

  • Re: Relocating application architecture and compiler support
    ... relocateable at an interrupt level. ... >>virtual memory addresses must stay put. ... > memory and that the same executable program image could appear (using ... timesharing on S/360 including relocating programs as they were ...
    (comp.arch.embedded)
  • RE: low memory]
    ... It is the greatest program for twicking and finding memory issues and ... relocating stuff. ... APP's there to free up storage space so your Program Memory is maximized. ... And see the auto launch stuff so you can turn off ...
    (microsoft.public.pocketpc)
  • Re: rebase native images, please help
    ... > relocating a dll at runtime affects perf will depend on your specific ... It will definitely affect the working set a lot as the entire ... >> the startup time of a typical application. ...
    (microsoft.public.dotnet.framework.performance)