I recently upgraded my engine and physics .dll's to XNA 4.0 and Bepu 14.2. Previously, one of my test scenes was generating no memory usage whatsoever after reaching steady running state. Now, it's generating something on the order of 40 bytes per frame. Specifically, it's allocating BEPUPhysics.HashSet<T>.Enumerators from within the SimulationIsland.TryToDeactivate() method, with call stack
Space.Update->Space.UpdateWithInternalTimeStepsMultithreaded->Space.UpdateDiscreteMultithreaded->Space.SleepPulse
I haven't looked at it in reflector yet, but it looks offhand like you have a method enumerating an IEnumerable that has a value type enumerator, which will generate unnecessary garbage. Oddly, I never encountered this in 14.1 or earlier. Thoughts?
Edit: Yeah, looking at it in more detail, it's almost certainly your implementation of the new HashSet<T> emulator. You might take a closer look at that in your next change set.
14.2 allocating new garbage?
Re: 14.2 allocating new garbage?
That's interesting, I don't recall making any changes there. I'll take a look, thanks for the report.
Re: 14.2 allocating new garbage?
I can send you a sample project if you'd like, but it should be fairly straightforward to see it in the CLR Profiler on even a simple test scene.