-
Notifications
You must be signed in to change notification settings - Fork 65
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
Sampler doesn't free memory after deleting #169
Comments
There's a known issue with In short, thread pools are the reason we can't have automatic garbage collection. Until force close in the cloud client is implemented, and
The first approach is preferred at this point. And regarding the possible memory leak in qbsolv - we need to investigate that further. |
@randomir Thanks! Considering the second one I did:
and it had no effect on memory. Writing |
@randomir Actually the first method also doesn't seem to work:
resulted in:
Or am I doing it wrong? |
In the first example, yes, I meant " In your second example, you're doing it wrong 😃. Python doesn't collect garbage too often. You need to either wait a lot longer / allocate a lot more (iterate much more than 5 times), or invoke the GC yourself. |
@randomir I implemented the singleton approach and it works better now - good enough for my case, though not sure what's exactly happening under the hood. |
@mstechly, when you say better, what exactly do you mean? Are you seeing a constant memory overhead (no memory increase on each sampling), or something else? FWIW, we plan to make the underlying thread pools (in the cloud client) singleton objects. That should make |
@randomir It means that the memory still grows with each iteration, but slower with each consecutive one and stops growing at all at some point. |
That's interesting. We'll have that in mind (tests) when implementing singleton |
I'm closing this issue because it's a duplicate / known bug. |
Description
I noticed, that after running my script for a while, the memory footprint starts to grow over time.
It seems to be a problem with both
DWaveSampler
/EmbeddingComposite
andQBSolv
.Deleting the objects and running the garbage collector doesn't help to solve the problem.
Here is the output of the code posted below for
use_dwave=True
:and for
use_dwave=False
(usingQBSolve
):As you can see, the memory impact of QBSolv is much smaller (I needed bigger qubo to even observe this effect), but it's still there.
To Reproduce
https://gist.github.com/mstechly/1a0b077382d64fb417651f5cf405e67b
Expected behavior
I would expect that deleting an object and running the garbage collector should free the memory.
Environment:
The text was updated successfully, but these errors were encountered: