[Scummvm-devel] Discworld 2 memory issue

Max Horn max at quendi.de
Mon Oct 26 11:04:06 CET 2009


Am 26.10.2009 um 10:08 schrieb Paul Gilbert:
[...]
> Probably not a good idea to do hacks like this. I concur with the  
> prior emails.. off the top of my head, I think of any major reason  
> why the Tinsel heap manager couldn't be replaced with direct memory  
> allocations/freeings with only minor effort. Some of the existing  
> code, such as the heap compaction routine, couldn't be replicated in  
> a direct allocation scheme, but that might not be needed if we leave  
> everything up the operating system.

I am working on moving the allocation of "FIXED" blocks to be malloc  
based, but will not touch the implementation of "moveable" code  
otherwise. Because I don't think it is that trivial to switch to a  
purely malloc based implementation of the mem manager. For one thing,  
a lot of code never explicitly frees any data, so one still has to  
take care of that. Also, one would still have to watch out to not  
allocate too much memory, i.e. keep a global count of how much memory  
is malloced; if it is too much, some discardable memory blocks need to  
be discarded.
All of that can of course be done with a malloc based scheme, but IMO  
it requires some care to avoid introducing lots of leaks. So it's  
certainly no magic to make this change, but I'd advise against anybody  
rushing in and making it "blindly".

Bye,
Max




More information about the Scummvm-devel mailing list