[Scummvm-devel] memory footprint issues
max at quendi.de
Thu Mar 6 17:24:04 CET 2003
Am Freitag, 07.03.03 um 00:43 Uhr schrieb Marcus Comstedt:
> Ok, here are the preliminary results of my memory profiling.
> These are the 10 individual functions that had the largest memory
> footprint (maximum number of allocated bytes at any one time during
> the program execution) during my test run:
Were interesting results...
> 9000000 Sound::playBundleSound(char*)
Even without a leak, this allocates 1 MB temporary buffers to
decompress the sounds, even though typically less than 100 KB are
needed. There ought to be some way to figure out in advance how big the
buffer needs to be... ideally the game developers were clever enough to
store that information easily accessible somewhere.
In any case - that buffer should have been temporary - but it wasn't,
it was never freed. So each time a bundle sound plays (e.g. an actor
talks in The Dig / COMI), we leaked 1MB ! I fixed that in CVS.
> void*, unsigned long,
> unsigned, unsigned char, long, long)
It turns out that playStream() (which creates the ChannelStream
objects) is always called with a buffer_size of 2 MB (well 2 million
bytes). This seems to be to allow subsequent "append" calls... this is
very inefficient. We should replace this with a more flexible design,
More information about the Scummvm-devel