[Scummvm-cvs-logs] scummvm master -> 781e178df3c71441adf96c15c92edad6eab2b59d

bluddy yotambarnoy at gmail.com
Thu Apr 28 17:01:01 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
781e178df3 TOON: Reduced fragmentation by using a fixed value for pathfinding allocation


Commit: 781e178df3c71441adf96c15c92edad6eab2b59d
    https://github.com/scummvm/scummvm/commit/781e178df3c71441adf96c15c92edad6eab2b59d
Author: Bluddy (yotambarnoy at gmail.com)
Date: 2011-04-28T08:02:07-07:00

Commit Message:
TOON: Reduced fragmentation by using a fixed value for pathfinding allocation

Toon makes some rather big allocations for pathfinding, alternating between 3MB and 6MB). In small devices, this creates really bad fragmentation which can cause crashes. I set the size at a fixed 6MB.

Changed paths:
    engines/toon/path.cpp



diff --git a/engines/toon/path.cpp b/engines/toon/path.cpp
index 677876f..2635586 100644
--- a/engines/toon/path.cpp
+++ b/engines/toon/path.cpp
@@ -409,7 +409,11 @@ void PathFinding::init(Picture *mask) {
 	_height = mask->getHeight();
 	_currentMask = mask;
 	_heap->unload();
-	_heap->init(_width * _height);
+	// In order to reduce memory fragmentation on small devices, we use the maximum 
+	// possible size here which is TOON_BACKBUFFER_WIDTH. Even though this is 
+	// 1280 as opposed to the possible 640, it actually helps memory allocation on
+	// those devices.
+	_heap->init(TOON_BACKBUFFER_WIDTH * _height);	// should really be _width
 	delete[] _gridTemp;
 	_gridTemp = new int32[_width*_height];
 }






More information about the Scummvm-git-logs mailing list