[Scummvm-devel] SCI mem functions

Johannes Schickel lordhoto at gmail.com
Mon Feb 16 14:18:15 CET 2009


Filippos Karapetis schrieb:
> While reading through the SCI engine code, I noticed that there are 
> custom definitions of malloc, calloc etc, which can be used to trace 
> memory allocation (in sci/scicore/sci_memory.cpp). The question is: 
> should we adapt this approach in the rest of ScummVM?

It might be useful to allow a custom malloc/calloc/realloc/free and 
new/delete/new[]/delete[] implementation to have a possibility to trace 
memory allocation. But on the other hand were is this really needed? For 
leak checks it might be helpful, if we would keep a list of blocks etc. 
which can be shown if requested (maybe always at program termination). 
Apart I do not see too much use of it.

> Or remove these altogether and use "regular" calls to malloc and the like?

Actually in an C++ program you should try to avoid malloc and free, 
since they never call constructors for classes for example. But that is 
a different story I suppose... :-).

// Johannes




More information about the Scummvm-devel mailing list