[Scummvm-devel] Discworld 2 memory issue
Torbjörn Andersson
eriktorbjorn at telia.com
Sat Oct 24 18:52:04 CEST 2009
Max Horn wrote:
> It would be possible to rewrite the memory manager to use multiple
> chunks, but just using malloc definitely won't work, it does extra
> things like tracking references to memory.
Unless it does something very special, you could probably keep the
memory manager interface more or less unchanged but have it use
malloc/free internally, rather than using a pre-allocated memory chunk
though. It could still go through the list of allocated memory blocks
and discard the oldest, non-locked ones if it reaches some threshold value.
The Broken Sword 2 engine used to pre-allocate a large chunk of memory
too, but doesn't any more. It still needs its own memory manager because
the engine has a deeply held belief that data pointers - not just the
pointer to the allocated block, but any pointer to anywhere inside it -
can be stored as 32-bit integers. That was a bit painful, but hopefully
we won't need to jump through those hoops here.
And when I say "we", I of course mean someone else than me. ;-)
Torbjörn Andersson
More information about the Scummvm-devel
mailing list