Lua Refs lost (#4590)

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.

I also bumped into this a while back:

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

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

1 Like

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!

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

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

I’ve been trying to reproduce this today but have so far failed.