[Scummvm-devel] TOON memory usage

D G Turner d.g.turner at ntlworld.com
Thu Jul 21 00:29:59 CEST 2011


On 07/18/11 13:28, Marcus Comstedt wrote:
> 
> Hi all.
> 
> I've been looking a little bit on the memory usage in TOON, and why it
> fails to run on the Dreamcast, which has 16MB.
> 
> The main memory hog seems to be the path-finding heap, which is 6MB.
> 
> I've read the comment about why it is allocated for a 1280x400 screen
> instead of a 640x400 screen, but what I don't find any explanation of
> is why the heap is allocated with twice as many nodes as the maximum
> number of pixels.
> 
> In PathFindingHeap::init(int32 size):
> 
> 	_data = new HeapDataGrid[size * 2];
> 
> Why *2?  I don't see any evidence in the code for two nodes being used
> for a single pixel, so *1 should be enough, no?  (It's possible that a
> +1 is needed though, because the code seems to start using the array
> at index 1 instead of 0...)
> 
> Would someone care to explain, please?  :-)
> 
>   // Marcus

Marcus,
  After some discussion with SylvainTV and some comments from
eriktorbjorn, I have committed some cleanup to engines/toon/path.*
, reduced the size of the Pathfinding Heap by half and added code
to emit warnings if a pop is attempted on an empty PathfindingHeap or
more importantly, a push is attempted on a "full" PathFindingHeap.

This is:
https://github.com/scummvm/scummvm/commit/d035bcae826e4212ddda531633d3cf0666d57109

I have done a basic check on Toon and it seems fine, but I'll need to
play through the entire game to ensure it is still completable.

If you could confirm first whether this has reduced the memory usage
enough to solve the DC issues with this?

-- 
Thanks,
David Turner





More information about the Scummvm-devel mailing list