Dreikblack Posted August 1 Posted August 1 Tried to reproduce render issue, but must likely related. RAM and VRAM usage increase with every "load" despite clearing scene before every time (and using instance). After dozen times it's 4.1 Gb ram, on first was only 1.4 Gb. #include "Leadwerks.h" #include "ComponentSystem.h" #include "Encryption.h" using namespace Leadwerks; int main(int argc, const char* argv[]) { RegisterComponents(); auto displays = GetDisplays(); auto window = CreateWindow("Leadwerks", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); auto light = CreateBoxLight(world); light->SetRotation(45, 35, 0); light->SetRange(-10, 10); light->SetColor(2); auto box = CreateBoxBrush(world, 1,1, 1); box->SetScale(2); box->SetColor(0, 0, 1); auto scene = CreateScene(); int index = 0; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { Print("Before Load"); window->SetText("Loading"); scene.reset(); scene = CreateScene(); for (int i = 0; i < 35000; i++) { auto inst = box->Instantiate(world); inst->SetHidden(true); inst->SetPosition(Random(10000), Random(10000), Random(10000)); scene->AddEntity(inst); } auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -4); scene->AddEntity(camera); index++; window->SetText("Done " + String(index)); Print("After Load " + String(index)); } box->Turn(1); world->Update(); world->Render(framebuffer); } return 0; } 1 Quote Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5: https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/
Josh Posted August 1 Posted August 1 I simplified the code a bit. auto displays = GetDisplays(); auto window = CreateWindow("Leadwerks", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); auto framebuffer = CreateFramebuffer(window); auto world = CreateWorld(); //auto box = CreateBox(world); auto box = CreateBoxBrush(world, 1, 1, 1); box->SetCollider(NULL); box->SetPhysicsMode(PHYSICS_DISABLED); auto camera = CreateCamera(world); camera->SetPosition(0, 0, -4); std::vector<shared_ptr<Entity> > entities; auto tm = Millisecs(); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { auto now = Millisecs(); if (now > tm + 5000) { entities.clear(); window->SetText(GetMemoryUsage()); for (int n = 0; n < 1000; ++n) { auto inst = box->Instantiate(world); inst->SetPosition(Random(-100, 100), Random(-100, 100), Random(-100, 100)); entities.push_back(inst); } tm = now; } //Cleanup FlushEvents();// clear event queue world->GetEntities();// cleans entity list of weak pointers world->Update(); world->Render(framebuffer); } return 0; It looks like the leak only occurs when a brush is used. When a box model is created, the memory usage looks flat. Quote Let's build cool stuff and have fun.
Josh Posted August 2 Posted August 2 In the current build, the original example above provides unclear results. If it just a really bad memory leak, I would expect the RAM usage to increase by the same amount each time. Instead we see it either levelling off or slowing down. It is possible this could be a combination of the system reserving more RAM, in combination with a smaller mem leak, but keep in mind the example is creating and deleting 35,000 entities each time. The change I am seeing works out to 1.2 KB per entity, which is something to be fixed, but also is probably not a major immediate problem for anyone. 1 Quote Let's build cool stuff and have fun.
Qulex3 Posted October 20 Posted October 20 This bug is ruining my game. (2) (I will send a reminder message once a week until this issue is resolved.) (If the engine exits early access before this serious bug is fixed, it means that this error is either not taken seriously or has been forgotten.) https://youtu.be/8yncYDSF58E (This is an old video, but this bug is more noticeable in my game right now. When I exit and re-enter the main menu three times, I experience significant fps drops.) Quote
Josh Posted October 20 Posted October 20 Thank you, but please do not bump threads. I can easily see all unsolved threads at all times with the filtering menu in the top-right. Quote Let's build cool stuff and have fun.
Recommended Posts
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.