Jump to content

Release()


Rick
 Share

Recommended Posts

When I call Release() on the world, the Script:Release() for entities in that world doesn't seem to be getting called. I would expect this to happen so we can release things that we make in Start() (per the documentation). For example, how else would we free up the sounds in FPSPlayer.lua that are loaded in Start()?

 

This is important or else we'll have memory leaks when we switch levels.

 

 

I say this because of the following observation.

 

1) I have a simple scene with a floor, player prefab, 1 csg block with a level changing script attached to it.

 

2) I noticed when the world gets released when the player collides with the csg level (this sets a flag and in App:Loop() is where it checks to release the world, create a new one, then load the new map) that the memory slowly goes up.

 

3) I then put a System:Print("Releasing") inside the FPSPlayer.lua Script:Release() function and I never see it in the output. This leads me to conclude that this isn't working correctly causing a memory leak.

Link to comment
Share on other sites

You are correct. The documentation says "Release" but the engine actually calls the function "Delete". I am updating the documentation to use "Delete". Sorry about that.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...