Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetFreeMemory is broken since 1.6.4?

blaze Spinnaker
1/2 Serious
Join date: 12 Aug 2004
Posts: 5,898
11-20-2005 06:33
http://secondlife.com/badgeo/wakka.php?wakka=llGetFreeMemory

Can someone show an exmample of a memory leak?

If I go

l=[1,1,1,1,1,1]

g=[1,1,1,1,1]

l=g

Is that a memory leak?
_____________________
Taken from The last paragraph on pg. 16 of Cory Ondrejka's paper "Changing Realities: User Creation, Communication, and Innovation in Digital Worlds :

"User-created content takes the idea of leveraging player opinions a step further by allowing them to effectively prototype new ideas and features. Developers can then measure which new concepts most improve the products and incorporate them into the game in future patches."
Hank Ramos
Lifetime Scripter
Join date: 15 Nov 2003
Posts: 2,328
11-20-2005 08:35
Wouldn't the stack after executing "l=g" now contain 6 elements rather than 5?
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-20-2005 10:06
I don't think you can leak memory in LSL, I'm pretty sure there are internal garbage collection mechanisms that reclaim unused memory. Be very thankful for that :)

The example you listed would have caused a memory leak in C (to use one example), if l and g were pointers with dynamically allocated memory.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
11-20-2005 15:04
LSL does not use pass by refrence. When you set l=g a new copy of g is created and the pointer pointing to that copy is then stored in l. Of course l is released first. No you can't leak memory in LSL; llGetFreeMemory doesn't work properly anyway, it never has. llGetFreeMemory uses pointer subtraction to determin how much free memory there is, course this is totaly flaws as the memory isn't compacted or defragmented.

In java no memory leak would have been created as thats how garbage collection works in java. I'm pretty sure Mono works much the same way.
_____________________
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
Keiki Lemieux
I make HUDDLES
Join date: 8 Jul 2005
Posts: 1,490
11-20-2005 15:54
I created in effect a memory leak in a script I wrote. There was a list that I meant to periodically clear and add new values to. Well, I forgot to clear the list, so it would grow larger over time, consuming all the memory and breaking it.
_____________________
imakehuddles.com/wordpress/