Dan Posted August 29, 2011 Share Posted August 29, 2011 I have a simulation game that I've been developing for a while now and I'm at the point of "productizing" it for delivery to the customer. One of the tasks I have is to make sure there are no memory leaks in the software. What I'm currently seeing is that when I open the project in release mode with the latest engine.dll files, I see the Memory Usage static until I call an animate function on an entity. From then on, as long as something is animating, the memory usage continues to grow. When I minimize the application I see a huge amount of garbage collection being done, but it still continues to grow again. I have no errors and the growth is different on different machines. I've tested this on NVidia Quatro FX cards and GForce cards so far and I see growth differently on each system but all grow. I also tested this with the Leadwerks engine.exe spinning cube and it also grows forever. That indicates that it's something in common with all applications like the dll file or something. Got any ideas to why this is happening and what I can do to fix it? Quote Windows XP SP3 Intel Core2 Extreme 3GHz 2GB DDR2 RAM 2x NVIDIA GeForce GTX 280 in SLI Link to comment Share on other sites More sharing options...
Canardia Posted August 29, 2011 Share Posted August 29, 2011 It's normal for Garbage Collected languages like BlitzMax, that they pump the memory usage up and then release it after a minute or so. You can see the memory usage also with SetStats(2). It's fixed in LE3, which has no GC. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
macklebee Posted August 29, 2011 Share Posted August 29, 2011 it sounds like you are using lua which does have garbage collection... try adding this somewhere inside a lua object script's Update or Draw function or in the main loop for standalone lua scripts: collectgarbage(collect) Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Dan Posted August 29, 2011 Author Share Posted August 29, 2011 it sounds like you are using lua which does have garbage collection... try adding this somewhere inside a lua object script's Update or Draw function or in the main loop for standalone lua scripts: collectgarbage(collect) I am using LUA on certain objects, but I'm not sure if that would solve anything because I see the memory growth in Leadwerks executables that are loading and texturing primitives. I'll try it though and let you know if it helps. Quote Windows XP SP3 Intel Core2 Extreme 3GHz 2GB DDR2 RAM 2x NVIDIA GeForce GTX 280 in SLI Link to comment Share on other sites More sharing options...
macklebee Posted August 29, 2011 Share Posted August 29, 2011 yes, it should help. this simple example shows the memory usage climbing when you do not perform garbage collection in lua: RegisterAbstractPath("") Graphics(800,600) fw=CreateFramework() SetStats(2) while AppTerminate()==0 do fw:Update() fw:Render() SetColor(Vec4(1,0,0,1)) DrawRect(250,150,300,300) --collectgarbage(collect) Flip(1) end if you uncomment the garbage collection you will see the memory usage be fairly steady. Oddly enough tho, in this example the SetColor() seems to be what is driving the memory usage.... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Dan Posted August 30, 2011 Author Share Posted August 30, 2011 yes, it should help. this simple example shows the memory usage climbing when you do not perform garbage collection in lua: RegisterAbstractPath("") Graphics(800,600) fw=CreateFramework() SetStats(2) while AppTerminate()==0 do fw:Update() fw:Render() SetColor(Vec4(1,0,0,1)) DrawRect(250,150,300,300) --collectgarbage(collect) Flip(1) end if you uncomment the garbage collection you will see the memory usage be fairly steady. Oddly enough tho, in this example the SetColor() seems to be what is driving the memory usage.... collectgarbage(collect) does not compile. I don't have that method anywhere. Is there something I need to download? Quote Windows XP SP3 Intel Core2 Extreme 3GHz 2GB DDR2 RAM 2x NVIDIA GeForce GTX 280 in SLI Link to comment Share on other sites More sharing options...
Josh Posted August 30, 2011 Share Posted August 30, 2011 It's a built-in Lua command, not C++. 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...
Dan Posted August 30, 2011 Author Share Posted August 30, 2011 It's a built-in Lua command, not C++. Do you have any ideas as to why the memory is growing even in the rotating cube tutorial? How do I prevent this? Quote Windows XP SP3 Intel Core2 Extreme 3GHz 2GB DDR2 RAM 2x NVIDIA GeForce GTX 280 in SLI Link to comment Share on other sites More sharing options...
Josh Posted August 30, 2011 Share Posted August 30, 2011 Please file a report in the bug tracker if there is a reproducable problem. 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...
Dan Posted September 18, 2011 Author Share Posted September 18, 2011 Just to let everyone know, this was resolved. First I updated my engine.dll file and that fixed most of the issue. Then I found that commenting out my HUD completely fixed the rest and I was able to see the garbage collection process working properly. I haven't gone into debugging my HUD script yet, but if I find a specific call that is causing it, I'll post the results. Quote Windows XP SP3 Intel Core2 Extreme 3GHz 2GB DDR2 RAM 2x NVIDIA GeForce GTX 280 in SLI 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.