On Wednesday, 22 August 2012 at 20:26:37 UTC, BLM768 wrote:
I'm trying to figure out the allocation model that the port
should use. Bullet normally provides its own allocators for
efficiency, but I've been trying to integrate the port with the
GC where it's practical. Does anyone have suggestions on the
best approach?
I'm not too familiar with Bullet's allocation system, so I
should probably research that...
I've used Bullet in a professional capacity, and I'd hesitant to
force the GC on your users. I'd port their allocators and supply
implementations that map to malloc or the GC and let users that
have their own heap implementations map them to those.
There are a couple of reasons for this:
1) Most large game engines/simulations probably already have
several types of custom allocators that they'd like to map bullet
allocations to.
2) GC is not necessarily the best model for keeping track of
physics data. Usually, physics objects are tied to their game
entity counterparts and should be cleaned up as soon as those go
away. This ownership is mostly unambiguous, so its not much of a
burden to remember to clean up the physics objects. I used ref
counting when I set up my company's implementation but even that
is probably not necessary.