The Truth About the GE

I am.

I’m having some trouble right now, but I’ll soon return to GE development.

Hi, all. I am really glad that someone is dealing with memory leak problems :). I am trying to find a solution some time by python scripting in game projects (use garbage collector during scene change). Until now i havent find a python script solution.
I have studied the problem some time and I think that memory leak problem is in entire Blender, not only BGE. I have posted a few demonstration of the problem – problem appears not only in “scene manipulation”, but in “add object” feature of BGE too. You can find my demonstration blend files in this thread of Cyborg Dragon as REIKO´S MEMORY PROBLEMS (http://blenderartists.org/forum/showthread.php?t=109528).
PSK131 has found a partial solution in this thread (http://blenderartists.org/forum/showthread.php?t=109527) — you must have each scene in one file (blend or exe) --> scene change: simple script quits first scene and runs the second as a new file. This solution is working perfectly (thanks PSK131 ;)), but the window blinking during change is a little annoying and it doesnt solve the problem internally.
Please use my blend files to test your BPPlayer functionality. I would be glad to help find solution to memory leak problem.

Ovidiu, good to see you, sorry you have problems, but hopefully you’ll figure them out.

Not to worry, if C-106 Delta’s new player fixes the memory leaks, you can continue with the optimizations:D

I will try to fix memory leaks though the BPPlayer. But even if I don’t, using the free command inside blender itself would be much easier and safer. Here is a simple example code in C++. The value stored in the computer is called “memblock”. When we use “free(memblock);” it releases it from memory. :eyebrowlift:

 
string * memblock;
memblock = (string*)calloc(10000,sizeof(string));
free(memblock);

If you need to import that extra stuff, here is the extra code:


#include <string>
using namespace std;

Hey, thanks for sharing some C++ knowledge on fixing memory leaks, I’m sure Zaghaghi, Mal, or Ovidiu can use that to fix the memory leaks if your player doesn’t fix them.

You should go through the BGE code and make an online documentation of it so others can try to add their own features.

Anyone programming in C++ should use this to free the memory:

free(memblock);

and NOT

delete [ ] memblock;

This is a simple mistake made by a few C++ programmers. Keep in mind that C++ does not free anything by default. And if anyone does use the delete command make sure you use it like this:

delete memblock;

I can’t compile blender at the moment but I could compile a mini program to demonstrate this, if anyone wants it.

I want it.

Here is a link to the exe file. When using the exe, make sure that a blenderplayer.exe is in the same folder as this program, and make sure you look at the memory with Windows Task Manager.

http://uploader.polorix.net//files/418/FreeMemory.exe

PS: I made the icon in about 30 seconds, so it’s not that good.

As this thread has strayed several miles off-topic at this point, it is closed in the interest of clarity. C-106 Delta, you should start a new topic about your patches so the discussion can continue.