I'm working with pyside2.
How to invoke clean-up methods in c4d enviroment?
For example, i made app and if close it or check visibilty,then del app
from PySide2.QtWidgets import QApplication
app = QApplication.instance()
// steps with dialogs
if win.isVisible() == False:
clean objects, any garbage collection in memory
to my knowledge, there is nothing special going on in this regard with Cinema's Python interpreter. Also note that invoking del does technically not enforce an object to be garbage collected even in the most of vanilla Python interpreters. It simply removes a reference to an object from the current scope. If the reference count for that object is then zero on the next collection cycle, it might be collected. Even if you have just one reference to an object and you remove that reference, it might still linger in memory for quite a while after that. Long story short: You cannot really enforce the deallocation of memory in Python.
Hi @iluxa7k thanks for reaching out us.
With regard to your question, as already pointed out by @zipit , the Python del statement just is only responsible for decrementing the reference counter for the instance being "deleted" and not to actually free the memory used by the instance itself. This is clearly noted in the official Python documentation on the Note coming along with object.__del__(self) in Python 3 or object.__del__(self) in Python 2 .
Given that, also consider that the del app statement you've described in your first post might not actually deliver the "clean-up" action you're thinking about.