Lua Refs lost (#4590)

#1

Hi there!

I would like to know if the following is a bug and whether it is already known.

  1. create a collection
  2. the collection create a go with a script
  3. the script has something like the following
    if message_id == hash(“jump_”) then
    go.animate(id, “position.x”, go.PLAYBACK_ONCE_FORWARD, x, go.EASING_LINEAR, 0.5, 0.0,
    function() msg.post(".", “jump_”, {index = i}) end)
    end
  4. destroy the collection
  5. GOTO 1.

In each cycle the Lua Refs count increases by 1. If I remove the msg.post function inside the go.animate the Lua Refs does NOT increase and everything is fine.

Thank you for any advice!

Ciao, Rocco.

0 Likes

#2

I also bumped into this a while back:

0 Likes

#3

As far as I understand this is not the same problem. They are both related to lua refs and go.animate with a function starting again the animation at the end of the animation… (it seems I am lucky with these functions!)

The actual problem does NOT increase lua refs count until I destroy the collection containing it. Instead the old one increases the lua refs count each time the animation is performed.

I am somehow worried by this problem since I use the same structure in many many places in the game.

Thanks!

1 Like

#4

I’ve made a note to investigate this. Issue 4590.

1 Like

#5

Thank you as usual for your help!

At the moment my game is structured in “rooms”. Each time I destroy the old room and create a new room I see the Lua Refs Count increases by 10-20 units. And also the total lua memory and the total memory increases.

In order to debug this I have step by step simplified the code and it seems to me that I have found something that is clearly wrong in the fragment I described in my first post.

Ciao!

0 Likes

#6

It would help a lot if the problem could be isolated into a small example.

0 Likes

#7

I have struggled to make a small repro example, but till now I have failed. I see the error in the game (commenting out the msg.post line prevents any lua refs loss) but I cannot reproduce it… However I will keep trying.

1 Like