[Scummvm-devel] Weird crash (Mac OS X only? big endian only?)
Max Horn
max at quendi.de
Thu May 15 03:59:13 CEST 2003
Just a small update: running with a 6 MB buffer and full checking
produced no results: it worked just fine (albeit super slow), no crash,
no buffer modification detected.
I also made a check: the stripped binary (w/o simon and sky support) is
802412 bytes. The "dummyHeapBuffer" variable (the pointer to my heap
block) sits at address 791928 (i.e. well inside the code block, as was
to be expected), roughly 800kb. The heap block itself, however, starts
at 24272896 ~ 24 MB. So clearly there is already a large block of data
in between.
This could have various causes. E.g. on Mac OS X, before the scummvm
main() is called, SDL executes code to allocate the window etc. Maybe
that's what is taking up all that memory. That complicates the picture
a bit. It could be that memory corruption occurs inside that block, or
worse, might even be caused by SDL / OS specific code. But I have my
doubts, because other SDL apps have no similar problems, AFAIK.
I'll try to learn a bit more about the OS X memory layout. In the
meantime, I made a tiny test program:
#include <stdio.h>
#include <stdlib.h>
const int kDummyHeapBufferSize = 6 * 1024 * 1024;
void *dummyHeapBuffer;
int main(int argc, char *argv[]) {
dummyHeapBuffer = malloc(kDummyHeapBufferSize);
printf("&dummyHeapBuffer = %d, dummyHeapBuffer = %d\n",
(int)&dummyHeapBuffer, (int)dummyHeapBuffer);
free(dummyHeapBuffer);
}
File size is 9552 bytes, output is:
&dummyHeapBuffer = 8396, dummyHeapBuffer = 540672
-> so there are already 500 KB between the code and the first heap
block we allocated. Maybe by the C library (buffers etc.) ?
Cheers,
Max
More information about the Scummvm-devel
mailing list