[Scummvm-devel] Bugs blocking the DS port: SAGA Engine font loading crash, Options menus crash, GMM load/save crash
Neil Millstone
neil at millstone.demon.co.uk
Sat May 21 17:32:03 CEST 2011
On 16/05/2011 11:18, A. Milburn wrote:
> 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.
>
>
Hi Everyone,
In case you're interested, I found a bit more information about this. I
still don't know what's going on, but it looks like the cause is an
array template inside another array template. I commited a fix to
branch here which makes the game run again, which is suitable for the
upcoming release:
Commit:3ce4b76b0db10fe878305ed1c8b84c6bb1ad4883
* DS/SAGA: Due to what looks like a compiler bug, having one
Common::Array template inside another causes the DS build to crash
during Common::Array::resize(). The only fix I can find is to make the
internal byte array a normal malloc'ed() buffer. This way, the code
runs fine. Need to dig into the assembly output for this to find out
what's truly going on with the original code.
Thanks for everyone's input!
Cheers,
- Neil
More information about the Scummvm-devel
mailing list