In cpp it would be like:
import('sys').attr('modules')['mymodule'].del()
Thank you, it worked. However, I believe it would only remove one module, not any other module imported. I tried to clear the dictionnary, which worked in Python, i didn't achieve to reproduce this in c++. Anyway, this would free memory occupied by cycles in the python reference graph. But this is only a matter of memory leak, not really relevent in my context.

I tried another solution, which doesn't seem at first very suitable. I created a subinterpreter for each new execution of the script. Since there is never 2 execution at the same time, this ensure a good independance between distinct executions. It worked well. This may be a good solution, at least until the Py_Finalize issue is solved.

Thank you again for your help.

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to