Page 23 of 38

Posted: Thu Jul 29, 2010 10:18 am
by Zurzaza
I found and resolved a leak into "CIrrOdeGeomTrimesh.cpp", by adding

Code: Select all

  for(u32 i=0;i < m_aParams.size();i++)
  {
	  delete m_aParams[i];
  }
in the destructor.

It also seems that ODE make a call to a reserved memory:

Code: Select all

first-chance exception at 0x75e4c113 in Engine.exe: 0xC0000005: Access violation when reading 0xcccccccc.
every time step() function is called.

Posted: Thu Jul 29, 2010 11:37 am
by Brainsaw
Thanks. I added this to the SVN, but I need to do some more stuff, e.g. remove the objects from the global list in the IrrOde manager.

Posted: Thu Jul 29, 2010 5:29 pm
by Zurzaza
Ok, i fixed another leak in CIrrOdeManager that occurs if you don't call closeODE() function, so I added the call into the destructor:

CIrrOdeManager.cpp

Code: Select all

CIrrOdeManager::~CIrrOdeManager() {
	
	this->getIrrOdeNodes().clear();

	if(this->physicsInitialized() == true)
		this->closeODE();

	delete m_pOdeDevice;
	
}
Now, it seems there are other bugs into initPhysics() function, but i cannot get rid from they.. :@
I also noticed that there are some nodes that aren't deleted from the scene...but I don't understand why...

Posted: Thu Jul 29, 2010 7:46 pm
by Brainsaw
Thanks again, added your code to the SVN, although the destructor of the IrrOdeManager should only be called at the very end of the program as it's a singleton.

I think I'll have to do some cleanup. There are way to many lists in the manager. I'll check out every one of the within the next days and see which are needed and which are not.

Posted: Thu Jul 29, 2010 9:57 pm
by Zurzaza
Brainsaw wrote:the destructor of the IrrOdeManager should only be called at the very end of the program as it's a singleton.
I think that the destructor will be called automatically at the end of the program, if you don't call him before ;)

Posted: Fri Jul 30, 2010 7:28 am
by serengeor
Zurzaza wrote:
Brainsaw wrote:the destructor of the IrrOdeManager should only be called at the very end of the program as it's a singleton.
I think that the destructor will be called automatically at the end of the program, if you don't call him before ;)
If you delete an object, is destructor called than too? :oops:

Posted: Fri Jul 30, 2010 7:37 am
by greenya
serengeor wrote:
Zurzaza wrote:
Brainsaw wrote:the destructor of the IrrOdeManager should only be called at the very end of the program as it's a singleton.
I think that the destructor will be called automatically at the end of the program, if you don't call him before ;)
If you delete an object, is destructor called than too? :oops:
Yes.

There are two ways how you can use object, and destructor automatically called in both of them:

#1:

Code: Select all

...
{
    MyObject m;
    m.MyMemer = ...
    ...
} // here destructor auto-call
...
#2:

Code: Select all

...
{
    MyObject* m = new MyObject();
    m->MyMemer = ...
    ...
    delete m; // here destructor auto-call
} 
...
P.S.: same for constructors. That is the main purpose of its invention.

Posted: Fri Jul 30, 2010 7:57 am
by serengeor
Is there a reason why it would crash on destructor call (it contains some deletion code) if I called it myself, tough it doesn't crash if I put deletion code into a function?

Posted: Fri Jul 30, 2010 8:31 am
by booe
serengeor wrote:
Zurzaza wrote:
Brainsaw wrote:the destructor of the IrrOdeManager should only be called at the very end of the program as it's a singleton.
I think that the destructor will be called automatically at the end of the program, if you don't call him before ;)
If you delete an object, is destructor called than too? :oops:
Image
lol, first learn the basics of the basics of C++ basic and THEN eventually post HERE! This forum is not an interactive C++ tutorial! So SOD OFF!!

And change your avatar - its annoying.


btw: Brainsaw, is it possible to implement forcefields (like in nvidia physx) in irrOde? You'll have to get all objects in given area and apply forces to them every frame... ever tought about implementation of such feature?

Posted: Fri Jul 30, 2010 9:17 am
by Zurzaza
serengeor wrote:Is there a reason why it would crash on destructor call (it contains some deletion code) if I called it myself, tough it doesn't crash if I put deletion code into a function?
Depends on what you've put in your destructor...maybe you're deleting some pointers that are in use yet, so you'll have a segmentation fault.
and....please, if you've got other c++ basic questions, do not post here. thanks ;)

Posted: Fri Jul 30, 2010 1:47 pm
by serengeor
Ok, sorry :oops:

Posted: Fri Jul 30, 2010 4:44 pm
by ArakisTheKitsune
booe wrote:
serengeor wrote:
Zurzaza wrote: I think that the destructor will be called automatically at the end of the program, if you don't call him before ;)
If you delete an object, is destructor called than too? :oops:
lol, first learn the basics of the basics of C++ basic and THEN eventually post HERE! This forum is not an interactive C++ tutorial! So SOD OFF!!

And change your avatar - its annoying.
I saw like 1000 basic c++ questions here on forum. Maybe you want to tell them too to buzz off? Every one have to start from something, you can't blame anyone for asking such question. And I like your "change your avatar" line it's so nazi. You know what happeand to nazi on forum? They got eaten by the grue.

Posted: Fri Jul 30, 2010 4:55 pm
by serengeor
Well maybe he hates windows, for some unknown reason (doesn't know how to use them properly), i understand and i will change my avatar as soon as i can (NOT).

Again sorry for offtopic talks ;]

Oh and good wrapper does it leak how much does it use memory when its just initialized ?

Posted: Fri Jul 30, 2010 5:03 pm
by Zurzaza
serengeor wrote:Oh and good wrapper does it leak how much does it use memory when its just initialized ?
I think I didn't understand properly what are you asking...Are you asking for when this wrapper leaks...right?
It will make a leak every time you initialize a node, and when you call initPhysics() function ;)

Posted: Fri Jul 30, 2010 6:36 pm
by serengeor
well I didn't asked for a leaks, let me try to rephrase the question
How much memory does the wrapper use when initialized (the main physics class) without any collision bodies, and how much does it use for example 1 cube.