Manu,
The BASIC variable that contains the PYOBJECT can be cleared, and the memory used by that object returned by setting the variable to "".
Variables local to the subroutine ( not returned or in named common ) are cleaned up when you return from the subroutine.
As for the behavior on exit, the default setting of REINIT.PYTHON is set to ON. Which means that when a BASIC program finishes ( and returns to ECL/TCL ) the Python environment is reinitialized. So the memory is restored at exit.
Note that there are times that you may want/need to turn off REINIT.PYTHON, when this is done, the memory tied to BASIC variables will be released/restored, yet the Python environment will remain the same.
------------------------------
Mike Rajkowski
support
Rocket Internal - All Brands
DENVER CO United States
------------------------------
Original Message:
Sent: 07-27-2021 06:50
From: Manu Fernandes
Subject: PyObject and memory management
Hello,
I wonder how UNIBASIC manages memory allocated by python modules executed via pyCall which returns PYOBJECT. And especially if the memory is correctly restored at the exit of the programs and subroutines which instantiated these variables.
Is anyone who knows ?
------------------------------
Manu Fernandes
------------------------------