Soamp Posted June 20, 2010 Share Posted June 20, 2010 Hi, We were testing our game's performance. We noticed that "Mem Usage" grows continuously until we get "Not enough memory" error. We have evaluating our codes, we found two functions that cause this problem : object.model:GetVelocity(0) and self.vehicle:GetTireMatrix(n) Did anyone notice that before? Btw. We use 2.32R5 and LUA. Here is our confirmation tests description : To confirm the cause, we performed a simple test. We use 40 oildrums. Normally the Mem Usage stays almost steady. The problem begins when we add this to oildrum's code: function object:Update() object.model:GetVelocity(0) end It's a simple update script that only runs GetVelocity function. In this simple test, Mem usage kept growing til "Not Enough Memory" showed up. I also attached our test oilrum.lua For evaluating the second function we can use the "ViperScout" vehicle. You drag a Viperscout in editor and the mem usage starts to grow. If you create more viperscouts, you can feel the mem usage growing, more obvious. Now we comment these lines in ViperScout.Lua : Line no Line --------------------------- 18 self.tire[n]:SetMatrix( self.vehicle:GetTireMatrix(n) ) 20 self.emitter[n]:SetMatrix(self.vehicle:GetTireMatrix(n)) 23 speed = math.abs(self.model:GetVelocity(0).z) we add "speed=0" after line 23 to prevent any errors. Now there is no growing in mem usage! You can create viperscouts as many as you want and the mem usage stays almost steady! I also attached our test ViperScout.lua I think these are some bugs that occur in vehicle codes. Sorry for such a long post ;-) I hope solution is short ;-) vehicle_viperscout.lua oildrum.lua Quote Link to comment Share on other sites More sharing options...
Soamp Posted June 22, 2010 Author Share Posted June 22, 2010 Is it because of my long post that there is'nt any replys or what? Did anybody even check this? Quote Link to comment Share on other sites More sharing options...
Roland Posted June 22, 2010 Share Posted June 22, 2010 Maybe some did, but memory leaks are not always easy to catch, so that may be the reason you have not got any answer. Usually the community gives quick answers. I cant help you either as I do all my stuff in C++ only. Hopefully someone will help though. At least you have now seen that someone read your post Quote Roland Strålberg Website: https://rstralberg.com Link to comment Share on other sites More sharing options...
Flexman Posted June 22, 2010 Share Posted June 22, 2010 I read it too although it's not something I've come across, I've never tried to do what you're doing. But I'll give it a go tonight and see what happens. Quote 6600 2.4G / GTX 460 280.26 / 4GB Windows 7 Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT Tricubic Studios Ltd. ~ Combat Helo Link to comment Share on other sites More sharing options...
TylerH Posted June 23, 2010 Share Posted June 23, 2010 My applications leak 16kb a second if the window is out of focus, regardless of language. Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
DaDonik Posted June 23, 2010 Share Posted June 23, 2010 There is no memory leak in C, when i pause the engine every time window is out of focus. It's another thing when you don't pause it, though. Quote (Win7 64bit) && (i7 3770K @ 3,5ghz) && (16gb DDR3 @ 1600mhz) && (Geforce660TI) Link to comment Share on other sites More sharing options...
Mumbles Posted June 23, 2010 Share Posted June 23, 2010 Interestingly, I'm not experiencing leaking at all, and I'm using C... Loading a very primitive scene: A large blue box as the floor with zero mass 3 small light-weight red boxes, and 1 small green box (weighing the same as all 3 red boxes.) Sample 'cars' seeing how much force is needed to make them move at a decent speed. During loading, goes up to ~125 MB Once loading is finished, it drops to ~48 MB and stays there minimise the app, and the memory drops down to 8112 KB, and again, stays there (If the app is windowed it stays as ~48 MB) bring the app back to being the active window, and memory usage will rise to ~12 MB, once again, stays there (Again, this only happens if the app is full-screen) However, if my app does not sleep it's idle time, then when paused, the memory will climb to 13 MB, and then drop down to 2 MB. Climb to 13 again, drop back to 2 again, and so on... So not only does it use less memory after minimising->restoring, but it also doesn't look any different (Presumably, textured meshes would lose their textures in this case - I'm still using coloured cubes as placeholders). I'm not saying that this is a fault, just an observation. Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
macklebee Posted June 23, 2010 Share Posted June 23, 2010 I think what soamp is seeing is only in the editor... I tried his viper and oildrum scripts, and it appears that the memory usage of the editor slowly rises... I added this to the Update function of the oildrum script he provided: collectgarbage(collect) and it appears to have stopped the slow steady increase in memory usage. I tried just his script and the original viperscout script together and it continuously raised the memory usage. I just added that one garbage collection to the oildrum script's Update function and it halted the increase. It appears as long as there is one garbage collection in one of the Update functions that it will do the job. I haven't noticed this problem in bmax with lua scripts maybe because I perform garbage collection in bmax? I cannot speak for the other languages, but perhaps that's why it hasn't been an issue if you are using another language in conjuction with lua. 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...
Soamp Posted June 24, 2010 Author Share Posted June 24, 2010 Thanks macklebee, The problem solved with "collectgarbage(collect)" You were very helpful Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 24, 2010 Share Posted June 24, 2010 glad i could help 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...
Meldrion Posted June 24, 2010 Share Posted June 24, 2010 glad i could help I had the same problem but your solution with the Garbage Collector helped me out too. Thank you very much Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 24, 2010 Share Posted June 24, 2010 I had the same problem but your solution with the Garbage Collector helped me out too. Thank you very much youre welcome! 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...
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.