|
Haruki Watanabe
llSLCrash(void);
Join date: 28 Mar 2007
Posts: 434
|
09-12-2008 04:35
I have a script that reads a notecard and adds the contents to a list... When this is finished, I get (with llGetFreeMemory()) a a value of about 32000 bytes left. Then, I'm passing this list to another script, using llList2CSV()... The receiving script converts this string into a list again (llCSV2List) and - tadaaa - the list uses 3 times the memory... oh well... 
|
|
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
|
09-12-2008 04:45
Sounds like when you're measuring free memory the first time that you're doing so only when one copy of the list exists.
In order to perform llCSV2List you need the full list as a string (which isn't very efficient memory-wise either), you then create a copy of the list by breaking apart the string, that list is then copied into memory (the variable you assigned the result to). So three times sounds about right, it's always pretty much been like that.
The thing to note is that llGetFreeMemory() is /historical/ memory count, not an exact measure of free memory, so, while performing llCSV2List you DID use 3 times the memory, but once complete the parsed list will take up about the same amount of space as the original list.
Another thing to consider, is that llCSV2List does NOT preserve type, thus every single entry in the parsed list will be a string, even if it was a vector before. In the case of floats especially (and thus vectors/rotations) this is quite wasteful, as floats are represented by a six or seven character string (6 or 7 bytes) opposed to their normal 4 byte representation.
_____________________
Computer (Mac Pro): 2 x Quad Core 3.2ghz Xeon 10gb DDR2 800mhz FB-DIMMS 4 x 750gb, 32mb cache hard-drives (RAID-0/striped) NVidia GeForce 8800GT (512mb)
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
09-12-2008 05:34
From: Haravikk Mistral Sounds like when you're measuring free memory the first time that you're doing so only when one copy of the list exists.
In order to perform llCSV2List you need the full list as a string (which isn't very efficient memory-wise either), you then create a copy of the list by breaking apart the string, that list is then copied into memory (the variable you assigned the result to). So three times sounds about right, it's always pretty much been like that.
The thing to note is that llGetFreeMemory() is /historical/ memory count, not an exact measure of free memory, so, while performing llCSV2List you DID use 3 times the memory, but once complete the parsed list will take up about the same amount of space as the original list.
Another thing to consider, is that llCSV2List does NOT preserve type, thus every single entry in the parsed list will be a string, even if it was a vector before. In the case of floats especially (and thus vectors/rotations) this is quite wasteful, as floats are represented by a six or seven character string (6 or 7 bytes) opposed to their normal 4 byte representation. it wouldn't hurt to blank any string or list variables, once you're done using them.
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|