Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

dataserver / notecard question

Rizado DaSilva
Merchant
Join date: 12 May 2005
Posts: 30
01-31-2006 12:51
Ok, I am playing with a config file for reading in canfiguration variables into a script. What I have noticed is that when I hard code the variables into the script I have like 2000 bytes left when it is finished loading the script.

When I use a dataserver to read the notecard and get the exact same variables, I have about 700 bytes left?

Anyone shed some light on this?

Thanks,

=R
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
01-31-2006 13:26
From: someone
http://secondlife.com/badgeo/wakka.php?wakka=llGetFreeMemory
llGetFreeMemory will not take into account memory that has been freed, resulting in far less free memory reported than actually exists. What it will report is the historic free memory--the smallest free memory up until that point.

CODE
dataserver(key qid, string data) {
myvar = data; // the contents of 'data' are now in memory twice
} // now 'data' is freed, even though llGetFreeMemory() won't notice
Rizado DaSilva
Merchant
Join date: 12 May 2005
Posts: 30
01-31-2006 14:13
CODE
 dataserver(key qid, string data) { 
myvar = data; // the contents of 'data' are now in memory twice
} // now 'data' is freed, even though llGetFreeMemory() won't notice


While I would agree with that, after I noticed this I created two seperate scripts, the first which loaded the global variables and no notecard system at all...
CODE
string myvar = "a bunch of text";

And the second which loaded blank global variables and then updated them via the notecard...
CODE

string myvar;

dataserver
(key qid, string data) {
myvar = data; // the contents of 'data' are now in memory twice
} // now 'data' is freed, even though llGetFreeMemory() won't notice


and still the same result. Perhaps I am not understanding your response? Are you saying that; myvar (empty variable) and myvar (with data) are both in memory now?

Thanks
=R
Masakazu Kojima
ケロ
Join date: 23 Apr 2004
Posts: 232
01-31-2006 14:58
myvar = data;

After this, 'data' and 'myvar' are both in memory with separate copies of the same data. So if data contained 5000 bytes, you would be using 10000 bytes until the end of the event handler, when data is freed, or (maybe) until you clear 'data' yourself. Either way, llGetFreeMemory() would from then on report the amount of free memory there was when 'data' was still in memory.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
01-31-2006 15:15
yep :)
Rizado DaSilva
Merchant
Join date: 12 May 2005
Posts: 30
01-31-2006 16:41
Grrr... yes, I see that now, I guess my head was, err, ne'er mind that... I totally missed it, but makes sense. LL has GOT to start upgrading this stuff.

Thanks for the explaination.

=R
Mildred Davison
Registered User
Join date: 17 Nov 2005
Posts: 1
02-01-2006 08:36
From: Masakazu Kojima
myvar = data;

After this, 'data' and 'myvar' are both in memory with separate copies of the same data. So if data contained 5000 bytes, you would be using 10000 bytes until the end of the event handler, when data is freed, or (maybe) until you clear 'data' yourself. Either way, llGetFreeMemory() would from then on report the amount of free memory there was when 'data' was still in memory.


Except that lines are a maximum 256 bytes...