about game objects spawning

Hi,guys!
I read about a lot about sth. like it,some tell me game objects spawning and destructing dynamically leads memory fragmetaions,is there better solution in PANDA?Or,tell me about it in detail!Thanks a lot~~~

panda’s solution is: “you don’t need to worry about that”

that applies to most things you may read about. just give it a try. panda does an incredible job at keeping the trouble out of your way. so in most cases there is no need too worry about problems until you really experience them. and if you do, panda comes with great profiling tools to help you identify and fix the problem in question.

Would you describe the algrothims in panda about this?
Actually,why the engine can face it,is that not OS’s problem,they can handle it for engine,for me???

Panda3D is using Python’s memory management, which has two parts.

Part One: References to objects

Part Two: Garbage collection

Python keeps count of all the references to an object. Once the references are all gone for an object, that object is disregarded (trashed).

You can actually run a search online and get more info on this. Just type “python memory management” in your browser’s search box or something.

The funny thing is,
If you try to trash and object and forget to delete just one reference, you can mess up python’s method 1 for memory management; but that’s where the method 2, garbage collection is suppose to come in, according to python documents I read.

Python is suppose to find all objects that become trapped in memory and clean them out. I don’t think you’ll get that with Panda3D. I came across that problem already.

I was trashing an object but had a reference or two left, and caused my object to get stuck in memory without being able to access it. Python’s method 2, garbage collection, never freed up the memory my object used…not entirely anyway.

When I worked out all the issues within my code, then and only then did python properly dispose of my object.

I would say, as long as you can truly identify things in your code that might mess up the removal of an object, then you don’t have to worry about it and you should never see your memory growing without end.

Otherwise, as I found out the hard way, if you can’t recognized all the things that might cause an object deletion to fail, then get ready for some debugging hell!

I’m still recovering from pulling my hair out over this.
Lol

I want ask how to handle the memeory space fragmentation!

ThomasEgi just told you: You don’t have to worry about that - Python handles it for you.