Skip to content

Noob question: how to manually free the memory of an array #633

Answered by inducer
TsXor asked this question in Q&A
Discussion options

You must be logged in to vote

Memory will be freed after the last reference to an object goes away. At x = b**2, the local variables a and b are still holding references to the input arrays.

To manually free memory (technically: release the reference to the buffer, because OpenCL has its own refcounting): https://documen.tician.de/pyopencl/runtime_memory.html#pyopencl.MemoryObject.release

i.e.

a.base_data.release()

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@TsXor
Comment options

@TsXor
Comment options

Answer selected by TsXor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants