-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add missing call to finalize the interpreter on NatSpeak shutdown #129
Conversation
This should allow things like the built-in *atexit* module to work.
Had some trouble setting Natlink up in order to test this, but I can confirm the change hasn't broken anything. The I did notice an interesting caveat in the Python/C API Reference Manual that applies to Natlink:
Embedding Python (final paragraph) |
I did mention this to Doug on telegram, he thought it wasn't too much of a concern as it's not reinitialized too often. For reference https://stackoverflow.com/questions/42971734/memory-leak-when-embedding-python-into-my-application Could PyGC_Collect() be called right before Py_Finalize()? |
I do not think this is do to the pr. Just a heads up, I think there's a bug when NatLink shuts down. So I loaded it with an empty debug says Process from 'messaging from natlink' is still running. Despite dragon being closed. Once closed from task manager when dragon restarts it functions as expected. |
I agree, not a big deal. I just thought it was interesting.
…On Fri, 02 Sep 2022 08:04:59 -0700 LexiconCode ***@***.***> wrote:
> Had some trouble setting Natlink up in order to test this, but I can confirm the change hasn't broken anything. The `atexit` module works properly now, as do other tasks normally performed prior to the termination of python.exe. This PR is ready to be merged.
>
> I did notice an interesting caveat in the _Python/C API Reference Manual_ that applies to Natlink:
>
> > Notice that Py_Finalize() does not free all memory allocated by the Python interpreter, e.g. memory allocated by extension modules currently cannot be released.
>
> _Embedding Python_ (final paragraph) [docs.python.org/2/c-api/intro.html#embedding-python](https://docs.python.org/2/c-api/intro.html#embedding-python)
I did mention this to Doug on telegram, he thought it wasn't too much of a concern as it's not reinitialized too often. For reference
https://stackoverflow.com/questions/42971734/memory-leak-when-embedding-python-into-my-application
--
Reply to this email directly or view it on GitHub:
#129 (comment)
You are receiving this because you were assigned.
Message ID: ***@***.***>
|
There is no need. |
Yes, the behaviour you mention is unrelated. I didn't get this when I tested the change yesterday. I have previously seen natspeak.exe hang around after it should have exited. Not sure there's anything that can be done about that. Maybe it's doing some maintenance. |
The issue #184 points to this issue, to not forget. |
This pull request adds a missing call to
Py_Finalize()
in COM\appsupp.cpp. This should allow things like theatexit
module to work.I have set this as a draft PR for the moment. Still need to compile and test that this works fine.