Home › Forums › Programming › Havok
- This topic has 5 replies, 4 voices, and was last updated 15 years, 6 months ago by Anonymous.
-
AuthorPosts
-
-
01/10/2008 at 10:12 am #6957AnonymousInactive
Hey everyone. Has anyone here had any experience working with the Havok physics engine ? I just have two quick questions about it..
(1) – What is the correct way to manage memory / allocated objects ?
I notice that none of the demos use delete on allocated physics objects, instead using only removeReference() to do the cleanup. Is it safe to assume that these object’s being cleaned up accordingly by the base system or self deleting themselves when the reference count is zero?(2) – I’m running a multi-threaded simulation, but I let it finish before proceeding with game logic that requires access to the sim data. However, I do have some phantom objects with call-backs in the world.
Say if I wanted to modify/read the world within these callbacks whilst the simulation is still running in parallel, what is the correct procedure to follow in order to do this ? Is it just a case of calling lock() and unlock() on the world (and markForRead() etc. in debug) or is there more to it than that ?
Thanks.
-
01/10/2008 at 2:45 pm #42448AnonymousInactive
-
01/10/2008 at 4:29 pm #42450AnonymousInactive
Are you guys going in for the competition then?
-
02/10/2008 at 8:10 am #42452AnonymousInactive
Thanks for the help Dave. That’s pretty handy actually- kinda like COM objects and their reference counting mechanism.
Yeah I’m gonna have a pop at the competition with the lads from Carlow. We’re still finalizing our idea but we’ve got a few knocking around atm.
-
02/10/2008 at 4:08 pm #42455AnonymousInactive
Thanks for the help Dave. That’s pretty handy actually- kinda like COM objects and their reference counting mechanism.
Yeah I’m gonna have a pop at the competition with the lads from Carlow. We’re still finalizing our idea but we’ve got a few knocking around atm.[/quote:75955a19a3]
Its essentially the smart pointer concept. They’re found in the boost library if you wanted to use in your own code. Presumably in Havok you can hook up your own heap to malloc and free the smart pointers from right?
-
02/10/2008 at 5:09 pm #42457AnonymousInactive
Presumably in Havok you can hook up your own heap to malloc and free the smart pointers from right?[/quote:3496b90b8e]
Looks possible anyhow. Memory management is done through the hkMemory interface so it would just be a case of implementing the functions to roll your own. You also have to create the memory manager at startup, allocate stacks etc. so you could use your own there.
-
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.