-
Notifications
You must be signed in to change notification settings - Fork 189
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
Fix memory leak in OpenGL visualizer #3533
Conversation
The OpenGL visualizer has a memory leak rate of around 12 MiB/min for simulations with polymers, and 3 MiB/min for simulations with shapes containing cylinders. Memory allocated by `gluNewQuadric()` must be freed by `gluDeleteQuadric()`.
The OpenGL.GL submodule of OpenGL 3.1.0 contains an infinite recursive import to itself.
@christophlohrmann please check a few samples, e.g. the following are directly affected by this PR: ./pypresso ../samples/visualization_bonded.py --opengl
./pypresso ../samples/visualization_constraints.py --simplepore
./pypresso ../samples/visualization_constraints.py --slitpore
./pypresso ../samples/visualization_constraints.py --cylinder
./pypresso ../samples/visualization_constraints.py --spherocylinder |
Codecov Report
@@ Coverage Diff @@
## python #3533 +/- ##
======================================
- Coverage 87% 87% -1%
======================================
Files 536 536
Lines 24177 24177
======================================
- Hits 21063 21057 -6
- Misses 3114 3120 +6
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shapes look like they are supposed to. Also memory doesn't blow up after longer runtime.
Still, in the samples, particles are on both sides of the constraints and also can hop across the constraints
I've just tried to rewrite the particle placement loop to make some shapes impossible to cross, but it didn't work for the slitpore, where particles spawn too close to each other due to the confined geometry. Particles crossing constraints is most likely a side-effect of the force capping mechanism, which prevents the force from becoming infinite when crossing a wall or surface. Writing custom particle placement code for each constraint and validating the simulation against crashes for each constraint in CI seems too much work for such a simple sample, and will make the sample a lot more difficult to re-use by novice users. |
you should use energy minimization instead of force capping |
We use steepest descent to minimize the energy, and then the Langevin thermostat with a high gamma. The force capping is there to prevent the simulation from crashing. |
Fixes #3530
Description of changes:
Cylinder
,SpheroCylinder
,SimplePore
,Slitpore
)visualization_constraints.py
sample that prevented aSlitpore
from being added to the list of constraints