[Scummvm-devel] Fwd: SCI mem functions

Oystein Eftevaag wintermute at geheb.com
Wed Feb 18 08:41:19 CET 2009


It -can- be a matter of recovery as well, if you're using any caches and 
other memory that might not be used right now and will be reallocated at 
need. The memory functions would simply check the result from the OS 
malloc call, free up the caches if it fails, then try again.

I'm guessing we don't use a lot of caches, though :).

But yes, printing a simple assert message when you run out of memory 
would probably be a good idea (you could also print other details like 
attempted allocation size and total memory usage).

But IMO this should still be platform specific. And definately NOT use 
any wrapper functions that'll replace new/malloc/free/delete everywhere, 
but rather hook the functions directly like I explained earlier.

// Oystein/vinterstum

Kostas Nakos wrote:
> Vicent Marti wrote:
>   
>> Well, how exactly would you recover from running out of memory in a
>> portable device?
>>     
>
> It is not a matter of recovery. It is a matter of breaking out right at 
> the spot where the error occurred as opposed to continuing execution 
> from an unforeseen state, potentially clobbering the process' memory and 
> crashing a couple of function calls later. Often times this is not cool 
> to debug.
>
> Kostas
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Scummvm-devel mailing list
> Scummvm-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scummvm-devel
>   





More information about the Scummvm-devel mailing list