Comments (6)
thread keyword to allow people like me to find it more easily:
memory leak
from kiwi.
In general, a variable can exist in more than one constraint, and tracking when a variable no longer appears in any constraints would be expensive. If you want to fully clear a solver, you can call solver.reset()
which will remove everything.
from kiwi.
Yes, but uncontrollable growing is sometimes more troblesome than expenses due to variables cleanup. That is exactly my case, long run solver with frequently changing constraints set eventually leaks all the RAM.
Can you please provide some hints how to implement variables cleanup functionality?
from kiwi.
In Enaml, such unbounded growth could occur by continuously adding and removing new widgets from a layout, but Enaml deals with this case by resetting the solver when it gets new layout items and re-adding all relevant constraints.
https://github.com/nucleic/enaml/blob/master/enaml/layout/layout_manager.py#L295
I would suggest you follow a similar model and pick a reasonable time to reset the solver and then re-add all of your still-valid constraints. Checking whether a variable is still contained in the solver requires a linear scan over all rows in the solver. For a constraint with M variables, that would be an O(M x N) operation. Scanning for all empty variables would be O(N^2), at which point it's just cheaper to reset.
from kiwi.
Alternatively, you can reuse your old variables in your new constraints. i.e. manage your own free variable pool.
from kiwi.
Thanks! Periodically reset and re-add constraints should work for me.
from kiwi.
Related Issues (20)
- 1.3.2 final tag is not on GitHub HOT 3
- The performance compare when create many constraint use different language realize kiwi, why my c++ code is slow? HOT 4
- Missing wheel dependency? Installation fails. HOT 3
- Build fails with gcc on macOS HOT 2
- Is there a way to test if a constraint was broken? HOT 9
- 1.4.0 fails to build from source HOT 22
- Documentation: How to build on Windows HOT 5
- AssocVector implicit copy constructor warning
- Not compatible with setuptools >=61 HOT 1
- License info on PyPI contains complete license text HOT 5
- 1.4.2: pep517 warnings HOT 18
- pip install fails on Python 3.11b3 HOT 17
- Failed building wheel for kiwisolver :( HOT 4
- Cann't install on python 3.11b3 HOT 2
- 1.4.3 has no attribute __version__ HOT 2
- ERROR: Failed building wheel for kiwisolver: C2440: 'static_cast': cannot convert from 'expr_type' to 'type' HOT 2
- Provide cp311 releases HOT 1
- Objective cell memory leak? HOT 26
- Continuous fuzzing by way of Google's OSS-Fuzz HOT 1
- Tests fail on pypy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kiwi.