Jump to content

Memory Issue


brndx
 Share

Recommended Posts

The memory usage in my game appears to increase as the player progresses through more maps which leads me to believe that not everything is being released. This eventually results in a "not enough memory" error or vegetation / textures not loading. Are the sound sources released when world:clear() is called?

Link to comment
Share on other sites

Sound sources are not entities and are not linked to any world.  Therefore, clearing the world will not do anything to them.  Sound-emitting entities will be cleared, however.

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

Sounds should be released when you are done with them:

Sound* sound = Sound::Load("a.ogg");
Source* source = Source::Create();
source->SetSound(sound);//increments the reference count, so the sound does not get deleted yet
sound->Release();//decrements the reference count, sound will be deleted when the source is released

In Leadwerks 5 this will be automatic:

auto sound = Sound::Load("a.ogg");
auto source = Source::Create();
source->SetSound(sound);

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...