lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Saturday 14 October 2006 15:51, Asko Kauppi wrote:
> 
> The hook approach could be used for memory usage limiting, too?

To some extent, yes, but I don't see how it could be safe and 
reliable. The obvious problem is that a script could burn insane 
amounts of memory in no time by allocating very large blocks, or even 
by allocating a single gigantic block.


> Or   
> maybe it would be the All Best approach to provide each state with  
> their own alloc/free routines (Lua does make it easy).  In such
> case, the allocation could have a per-state limit, and if a state is
> killed (since it's a Bad Boy) also all allocated blocks could be
> released (since the allocator knows which they are).

Yeah, that sounds like a more solid solution.


//David Olofson - Programmer, Composer, Open Source Advocate

.-------  http://olofson.net - Games, SDL examples  -------.
|        http://zeespace.net - 2.5D rendering engine       |
|       http://audiality.org - Music/audio engine          |
|     http://eel.olofson.net - Real time scripting         |
'--  http://www.reologica.se - Rheology instrumentation  --'