Re: malloc() size limit
"Dave Calkins" wrote:
Thanks, I'll take a look at the modules list and see what it
looks like. Think there's any way to force load a DLL that you
didn't create at a different address?
I'm not sure it's possible unless you delve into low level stuff
like kernel mode drivers et all.
The point is this. There's enough room in the address space,
even under 32 bits, for the allocations we're talking about, its
just that the heap is fragmented. So my question was, how can
we pro-actively work to de-fragment the heap?
There is a cople of things that may help. First of all, you
mentioned in your other post that it's 3rd party library that
makes allocations, not your own code. If you're not able to
control its allocations, then you're pretty much screwed. Also,
you said that there is only about 500MB contiguous free space to
begin with. So, you have your address space quite fragmented
already. So here are the possible solutions that come to mind:
1. Use local DLL's as much as possible instead of shared DLL's.
(Read in MSDN about ".local" files.) Then use ReBase.exe tool to
patch DLL's so they load tightly. This may help you to start the
process with larger contiguous free space. There are still system
known DLL's, however I read somewhere that MS runs ReBase tool on
its own DLL's so they load nicely. Beware of legal issues if you
change 3rd party DLL's in your local folder. I don't know what are
the implications of this.
The main disadvantage of this method is that it doesn't guarantee
you successful results. There are a lot of thing on user's machine
that out of our control as Nathan mentioned.
2. Use Address Space Layout Randomization (ASLR) technique to set
desired base address for DLL's in your process. I don't know how
to implement it for certain process, probably some of Win32 API
functions must be hooked in order to accomplish that. I know it's
possible for Win2K/XP (see http://www.wehnus.com/ for example).
This will require a lot of painstaking work, but it will quarantee
you results.
HTH
Alex