Memory leak in cudaq.sample
Opened this issue · 1 comments
ikkoham commented
Required prerequisites
- Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
- If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
I found memory leak, see the following a code example for details:
Steps to reproduce the bug
import cudaq
for i in range(100000):
# print(f"\r{i}", end="")
kernel = cudaq.make_kernel()
result = cudaq.sample(kernel)
I run the code on jupyter notebook and kernel shutdown at i=21667
.
When I run the script (not jupyter),
JIT session error: Cannot allocate memory
Segmentation fault
Expected behavior
No segmentation fault
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA Quantum version: Latest
- Python version: Python 3.10.12
- C++ compiler: g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
- Operating system: Ubuntu with Docker on MacOS
Suggestions
No response
ikkoham commented
yes, it's python's issue.
#include <cudaq.h>
int main() {
for (auto i = 0; i < 10000000; i++) {
auto kernel = []() __qpu__ {};
auto counts = cudaq::sample(kernel);
}
}
works well.