Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Memory scale

CrystalShard Foo
1+1=10
Join date: 6 Feb 2004
Posts: 682
10-07-2004 13:38
Now here's an intresting question: How many bytes does a single Key inside a List takes from a script's memory?
Pete Fats
Geek
Join date: 18 Apr 2003
Posts: 648
10-07-2004 14:09
The following code...

CODE
default
{
state_entry()
{
llSay(0, (string)llGetFreeMemory());
list test;
test += llGetOwner();
llSay(0, (string)llGetFreeMemory());
}

}


Returns this:

Object1: 16069
Object1: 15997

So, I would venture to guess that each list entry would take up 72 bytes.
_____________________
CrystalShard Foo
1+1=10
Join date: 6 Feb 2004
Posts: 682
10-07-2004 14:10
I used to think the same as you Pete.

Unfortunatly, it was recently proven that the llGetFreeMemory() command is extremly unreliable, faulty, sucky, and in generaly - not trust worthy.

So I was hoping that someone would have a more technical response based on the type of variable used to store list items and key items.
Francis Chung
This sentence no verb.
Join date: 22 Sep 2003
Posts: 918
10-07-2004 16:23
From: CrystalShard Foo

Unfortunatly, it was recently proven that the llGetFreeMemory() command is extremly unreliable, faulty, sucky, and in generaly - not trust worthy.


I must've missed this one. Care to prove that llGetFreeMemory() is sucky?

It could be that lists kinda leak memory - it turns out you can't free the memory from a list, but you can reuse it.

As for your initial query, I've always thought that keys are internally stored as strings by LSL.
_____________________
--
~If you lived here, you would be home by now~
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
10-07-2004 23:24
From: Francis Chung
I must've missed this one. Care to prove that llGetFreeMemory() is sucky?

It could be that lists kinda leak memory - it turns out you can't free the memory from a list, but you can reuse it.

As for your initial query, I've always thought that keys are internally stored as strings by LSL.


Check your memory. Make a list. Check again. Delete the list. Check again.

THAT is why it sucks.
_____________________
</sarcasm>
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
10-08-2004 07:11
I've also seen someone post that you could modify the length of a list, then perform a check to see the length of the list, and that also would return some of the memory.

I also have another question.

In the area:

list test;
test += llGetOwner();

I thought llGetOwner() returned a key... does this mean that:

list text += llGetOwner();

...will NOT compile?

if it does compile, does this use up more memory than the previous on two lines?

My guess is that the compiler is not going to expend more memory... but I am curious.

Thanks,
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
10-08-2004 07:14
the overhead for each item in a list is 3 bytes. That is 3 bytes + the memory normally needed to store that data type. So a key would take 19 bytes.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Archaegeo Platini
Ancient Earth University
Join date: 12 Aug 2004
Posts: 152
10-08-2004 08:12
Anytime you use += with a list, you have to explictly make the thing your adding a list

ie

list fred;
fred += llGetOwner();

Will not give you the desired results, while:

list fred;
fred += [llGetOwner()];

will
_____________________
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Dean Archaegeo Platini
Ancient Earth University

Courses for the Second Life

secondlife://Sedig/211/46
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=