Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Garbage collection - step() #36

Open
tzaeschke opened this issue Oct 6, 2015 · 3 comments
Open

Garbage collection - step() #36

tzaeschke opened this issue Oct 6, 2015 · 3 comments

Comments

@tzaeschke
Copy link
Owner

As mentioned in issue #35, ode4j appears to allocate significant amounts of memory in some situations/systems ("3-4 MB/s").

The problem may be in the stepper which allocates large arrays for the solver during each step.

A solution could involve array pooling.

@tzaeschke
Copy link
Owner Author

I implemented an experimental hack which can be enabled with:
DxQuickStep.REUSE_OBJECTS = true;

This reuses a number of objects, including the large collision used in the stepper.

Could someone have a look whether it improves the situation on Android? We could apply the same approach to other places in the code.

@ppiastucki
Copy link

It looks like some improvement has been recently made in ODE too - see https://bitbucket.org/odedevs/ode/commits/506a3b3b93c2ef0da3e5030bf12e408aef59c2cd

@tzaeschke
Copy link
Owner Author

Yes, they seem to avoid allocating Ad, even if that is much smaller than other matrices (iMJ is 12 times bigger).
What I did in this patch is really just a hack and should definitely be extended to the matrix solver as well.
I also looked a few days ago at porting ODE changes to ode4j. But quickstep has changed considerably, so I suppose I need a week off for that. Maybe over the upcoming holidays.

Has anyone seen a measurably reduced GC load from my initial patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants