[Scummvm-devel] Bugs blocking the DS port: SAGA Engine font loading crash, Options menus crash, GMM load/save crash

A. Milburn fuzzie at users.sourceforge.net
Mon May 16 12:18:12 CEST 2011


On Mon, May 16, 2011 at 10:43:32AM +0100, Neil Millstone wrote:
> Sorry, yes, I did do that.
> 
> It crashes on the line _fonts.resize(_vm->getFontsCount()), on font.cpp 
> line 46.

I can only imagine this is memory issues of some kind, Common::Array's
operator= is adding 32 to the new reserved memory size(!) - something
dating back to 0fe3a0c6 in 2002 - so you get getFontsCount()*2 random
allocations of 32 bytes during the Common::Array::resize.

Perhaps try something like "if (array._capacity == 0) { _size = 0;
_capacity = 0; _storage = 0; return *this; }" in
Common::Array::resize after the "delete[] _storage;", and see if it
gets past that resize point, at least? (wjp's suggestion)

(I can't see why these would work and it wouldn't run out of memory
later, but maybe it's just very unlucky with the fragmentation at
this point?)

- fuzzie

P.S. Any objections to getting rid of the crazy +32 entirely? Arrays
forcibly growing every time you make a copy is not very friendly.




More information about the Scummvm-devel mailing list