[spambayes-dev] Win32 DLL base addresses

tim.s.stevens at bt.com tim.s.stevens at bt.com
Fri Jul 9 10:23:48 CEST 2004


Hi folks -

I'm new to this list, so apologies if this is OT or inappropriate.

I've installed the compiled spambayes (RC1, I think) & it's great.  However, I see that many if the DLLs have the same default load address 0x10000000 (the Visual studio linker sets this unless you specify a different value).  If two DLLs collide in the virtual memory map at load time, Windows must copy them to the page file &  patch all exported symbols' load addresses - consuming page file space & slowing (fractionally) load time.  A simple fix is to use Visual Studio's rebase.exe to determine non-colliding address space for you:

rebase -b 0x5a000000 pythoncom23.dll pywintypes23.dll ..\bin\outlook_addin.dll datetime.pyd exchange.pyd exchdapi.pyd mapi.pyd perfmon.pyd pyexpat.pyd select.pyd servicemanager.pyd shell.pyd timer.pyd unicodedata.pyd win32api.pyd win32clipboard.pyd win32event.pyd win32gui.pyd win32process.pyd win32service.pyd win32trace.pyd zlib.pyd _bsddb.pyd _socket.pyd _sre.pyd _ssl.pyd _winreg.pyd

I ran this from the directory that pythoncom32.dll was installed in.  This will inspect all the specified DLLs, & patch their headers to load them from (in this case) 0x5a000000 upwards - it's best to keep the lower areas of VM free for the heap manager.

When I write windows code, I either write a similar batch file & invoke it as a post-link step, or if there are only a couple of DLLs, you can manually choose load addresses in the linker settings.  I'd recommend www.sysinternals.com who have a free tool procexp.exe which will show this kind of thing up.

Regards,
Tim.



More information about the spambayes-dev mailing list