-
Notifications
You must be signed in to change notification settings - Fork 28
AMReX Initialize/Finalize as Context Manager #81
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
We cannot rely on the last del/reference drop to an object to really release and free the object in Python:
https://stackoverflow.com/a/17644536/2719194
import amrex
amrex.initialize([])
mfab = amrex.MultiFab( ... )
del mfab # freed in CPython, but not guaranteed by Python per se
amrex.finalize()This code can lead to Python holding on to mfab over the lifetime of amrex.finalize(). When using memory in an AMReX area, their actual free after finalize() will be UB and usually segfault.
Refs.:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request