Hi!
I’m working on a project where Panda3d is used to display some data in a window that can be opened and closed. While testing, I noticed an increase in memory when opening and closing the window multiple times.
I made a small project where I just render 100 empty frames, then close the window over and over to reproduce the issue and noticed that every time I open/close a window opened with WindowFramework* window = framework.open_window();
my frames took longer to render. I found out that I’m actually rendering an extra frame per framework.do_frame( Thread::get_current_thread() );
call.
Is there some cleanup code that I’m missing, or did I stumble on a bug?
I’m on windows 10, using the version 1.10.14 of panda, here’s my code:
#include "pandaFramework.h"
#include "pandaSystem.h"
#include "config_prc.h"
#include "configPage.h"
#include "load_prc_file.h"
#include <iostream>
int main()
{
while (true)
{
load_prc_file_data( "", "load-display pandagl\n\
win-origin -2 -2\n\
win-size 800 600\n\
fullscreen #f\n\
framebuffer-hardware #t\n\
framebuffer-software #f\n\
depth-bits 1\n\
color-bits 1 1 1\n\
alpha-bits 0\n\
stencil-bits 0\n\
multisamples 0\n\
notify-level warning\n\
default-directnotify-level warning" );
// Open a new window framework
PandaFramework framework;
framework.open_framework();
// Set the window title and open the window
framework.set_window_title( "Dis be where I test panda" );
WindowFramework* window = framework.open_window();
for (int i = 0; i < 100; ++i)
{
framework.do_frame( Thread::get_current_thread() );
framework.report_frame_rate( std::cout );
}
framework.close_framework();
}
}
here’s the output from framework.report_frame_rate( std::cout );
when I render only 1 frame each time instead of 100 to make it more readable