Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Stack Heap Overflow problem

Valradica Vanek
Registered User
Join date: 1 Aug 2006
Posts: 78
04-24-2007 03:38
I have a vehicle app where tapping on one particular key rapidly causes the stack heap to grow until it overflows. I have searched and scratched to find what might be the problem since none of the other keys do this. I have finally stooped to just detecting the sitation just before it all hangs and ejecting the Avatar and then resetting the script.

Is there any way to gracefully clear the stack without resorting to such abuse? It does not go away with time, which is the puzzler.

Is there any clever way to track down the culprit?

The script is very involved with many subroutines so I don't think it would be meaningful to post it here. I am not looking for a specific answer, but a more general answer about managing the stack heap and clearing it when necessary.

What kinds of things might cause it to grow so suddenly?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
04-24-2007 03:51
From: Valradica Vanek
I have a vehicle app where tapping on one particular key rapidly causes the stack heap to grow until it overflows. I have searched and scratched to find what might be the problem since none of the other keys do this. I have finally stooped to just detecting the sitation just before it all hangs and ejecting the Avatar and then resetting the script.

Is there any way to gracefully clear the stack without resorting to such abuse? It does not go away with time, which is the puzzler.

Is there any clever way to track down the culprit?

The script is very involved with many subroutines so I don't think it would be meaningful to post it here. I am not looking for a specific answer, but a more general answer about managing the stack heap and clearing it when necessary.

What kinds of things might cause it to grow so suddenly?

Remember that LSL is pass by value so any strings or lists that are being manipulated are being copied each time. This can/does eat memory especially if you are not using the hacks to recover what you can each time.
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
04-24-2007 04:57
Instead of the key directly causing the action, you could get the key to set a boolean flag to say that action is required. Then use the timer to initiate the action if that flag is set. The routine that carries out the action should clear that flag when it is done. That way you dont overflow the actions with your key.

However, if you want the action to be carried out the same number of times that your key is pressed, you would need to increment a counter with your key and decrement that counter with the called action.