Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Stack/Heap collision...

Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-21-2006 13:15
From: Adman Drake
Yeah, but how are they stored internally? :)

*ducks and runs*


*pounces*
no running away.

They are stored as strings internaly, there is only one operator for popping strings and keys off the stack (likewise for floats and integers). Not to mention if they was some evil encoding going on behind the scenes then the double string link message hack wouldn't work.
_____________________
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
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
03-21-2006 14:03
I also noticed that strings seem to be encoded in some fixed 2-byte Unicode format, and take almost exactly 2 bytes of memory per character. The overhead seemed about the same, in fact, I hit a stack-heap error sooner if I stored my data as a long string instead of a list of shorter strings. Strings allocate memory differently, they seem to grow in chunks. So when you hit the limit, it'll grow by a large amount, then stay there as you add the next few entries, then grow by a large amount again. Lists, on the other hand, seem to grow each time you add an entry, by the amount required.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-21-2006 19:40
From: Ziggy Puff
I also noticed that strings seem to be encoded in some fixed 2-byte Unicode format, and take almost exactly 2 bytes of memory per character. The overhead seemed about the same, in fact, I hit a stack-heap error sooner if I stored my data as a long string instead of a list of shorter strings. Strings allocate memory differently, they seem to grow in chunks. So when you hit the limit, it'll grow by a large amount, then stay there as you add the next few entries, then grow by a large amount again. Lists, on the other hand, seem to grow each time you add an entry, by the amount required.


*head tilts* they never mentioned moving to UTF-16; could you post an example script?

Lists don't fragment the script memory as much. When LSL moves to Mono it shouldn't be a problem any more (as memory will be allocated dynamicly, instead of having to work with a static pool).
_____________________
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
Greg Hauptmann
Registered User
Join date: 30 Oct 2005
Posts: 283
03-22-2006 01:02
how do you decompile LSL code? is it compiled someone on the client PC before it's sent to the server? is it truely compiled or does it go to a bytecode type format like java?
Kalleb Underthorn
Registered User
Join date: 30 Jul 2003
Posts: 40
03-24-2006 09:46
It is compiled, it's just compiled to bytecode. No, LSL is not translated to a native instruction set. That would be a security nightmare. The client PC compiles it, and uploads the resulting source and byte instructions to the asset server. Like a notecard with a raw binary payload.

As far as decompiling, you would probably have to do that by hand. Also, you don't have access to the LSL bytecode after it's been uploaded. When you edit a script, all you get is a copy of the source.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
03-24-2006 10:22
From: Strife Onizuka
*head tilts* they never mentioned moving to UTF-16; could you post an example script?


I can do better, I can post the test scripts and the test results :)

/54/92/91318/1.html

This was before 1.9, IIRC. If you can find an error in the test or the results, I would actually be pretty grateful, because this has required a major re-design in a pretty large project.
1 2