klepto2 Posted February 7, 2023 Share Posted February 7, 2023 #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 0, -3); auto texture = CreateTexture(TEXTURE_2D, 512, 512); auto pixmap = CreatePixmap(512, 512); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { texture->SetPixels(pixmap); world->Update(); world->Render(framebuffer); } return 0; } Using Texture::SetPixels (pixmap or buffer) leads to fast rising memory. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted February 7, 2023 Share Posted February 7, 2023 It might not be, but I will check. I have seen memory rise steadily for about ten seconds before it levels off. I think the Vulkan memory allocator just creates new buffers until some threahold is reached and it levels off. But I will test this and find out for sure. Quote 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 More sharing options...
klepto2 Posted February 7, 2023 Author Share Posted February 7, 2023 With the above sample (at least for me) the memory keeps growing constantly and later breaks the whole OS when no memory is left. 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
klepto2 Posted February 7, 2023 Author Share Posted February 7, 2023 if you use this: auto texture = CreateTexture(TEXTURE_2D, 2048, 2048); auto pixmap = CreatePixmap(2048, 2048); you can see the memory grow in Gb steps Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted February 7, 2023 Share Posted February 7, 2023 Okay, here is my test program. Of course, you can also see the memory usage if you have the VS diagnostics interface open: #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); //Create a world auto world = CreateWorld(); //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a camera auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->SetPosition(0, 0, -3); auto texture = CreateTexture(TEXTURE_2D, 512, 512); auto pixmap = CreatePixmap(512, 512); uint64_t mem = 0; //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { auto mem2 = GetMemoryUsage(); if (mem != mem2) { mem = mem2; Print(mem); } texture->SetPixels(pixmap); world->Update(); world->Render(framebuffer); } return 0; } Quote 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 More sharing options...
Solution Josh Posted February 7, 2023 Solution Share Posted February 7, 2023 Okay, the cause was I had a memory pool system, but I stopped allocating buffers from the mempool and just started creating them instead, but I was still recycling old buffers back into the pool, so the size grew and grew. I question whether a memory pool is really beneficial or needed on a modern OS, so I am just going to disable these completely. 1 Quote 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 More sharing options...
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.