[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Tables memory usage.
- From: Thomas Wrensch <twrensch@...>
- Date: Mon, 25 Aug 2003 20:03:38 +0000 (UTC)
A few tests suggest that the memory for 400 tables of the size you're
suggesting is approx 35K on a Windoze PC XP system. My quick and dirty
test (creating 1,000,000 tables of four elements one of which was a new
string value) is very accurate, but suggests you don't have to worry too
much.
- Tom
On Mon, 25 Aug 2003, [iso-8859-1] Jose Marin wrote:
> Date: Mon, 25 Aug 2003 16:24:51 -0300 (ART)
> From: "[iso-8859-1] Jose Marin" <jose_marin2@yahoo.com.br>
> Reply-To: Lua list <lua@bazar2.conectiva.com.br>
> To: Lua list <lua@bazar2.conectiva.com.br>
> Subject: Re: Tables memory usage.
>
> what worrys me is this small table constructors for each Object. each skill of each object will have a table.
>
> so, for 100 objects I will have 300 "subtables". Is that a problem?
> Is there som "smartier" way of do this? I mean, tables wich items have tables, also...
>
> my game runs on a PC.
>
> Jules Bean <jules@jellybean.co.uk> wrote:
> On Mon, Aug 25, 2003 at 02:33:22PM -0300, Jose Marin wrote:
> > Object{
> >
> > name = "object1",
> > flags = F_MONSTER,
> >
> > itens = {
> > skill_easy = { item1, item2 },
> > skill_normal = { item3, item4 },
> > skill_hard = { item4, item5 },
> > }
> >
> > }
> >
> >
> > Object is a function.
> >
> > I'll have dozens (almost hundreds) of objects like this.
> >
> > Is there som better way of do this? O Lua manges efficiently the memory?
>
> Looks fine to me. I shouldn't worry... unless, perhaps, your game is
> intended to run on an embedded platform with 64K memory or some
> similar thing.
>
> For reference, one way to improve memory usage yourself is to use
> userdata and manage the memory in C. A simple way of doing this is to
> use tolua and C structs. But I don't believe this is necessary for
> your example.
>
> Jules
>
>
>
> ---------------------------------
> Desafio AntiZona: participe do jogo de perguntas e respostas que vai dar
> 1 Renault Clio, computadores, cāmeras digitais, videogames e muito mais!
twrensch@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org