Title: Add soft shutdown by amos402 · Pull Request #958 · pythonnet/pythonnet · GitHub
Open Graph Title: Add soft shutdown by amos402 · Pull Request #958 · pythonnet/pythonnet
X Title: Add soft shutdown by amos402 · Pull Request #958 · pythonnet/pythonnet
Description: What does this implement/fix? Explain your changes. An upgraded version for #754 An implementation for #957 Also included some minor fixes. Still simple and roughly, reset all GC objects by a save state, the old domain objects will be leaking and unaccessible. Here's my next plan, I think I can replace all the clr objects slots to solid callbacks, that may help the memory leaking. How to use: use PythonEngine.Initialize(softShutdown: true) for startup. Updated Details: Changes from above: objects in GC chains will not remove by default, it can be setting by RuntimeState.ShouldRestoreObjects, and modules which not in sys.modules after just call initial CPython will be remove from sys.modules on soft shutdown mode. Multiple fixes about memory leaks and reference count errors. The heap types which represent managed types will degenerate to normal type objects by set their slot callbacks to some function that builtin CPython regardless of normal mode or soft shutdown mode. Before their degenerations, through using tp_travese and tp_clear to release their sub objects, then use SlotsHolder.ReleaseTypeSlots reset their slots. Points can be optimize for the above mechanism: tp_travese and tp_clear are not necessary for all time, they will become overhead for CPython's GC, maybe we can just use C# methods instead. Maybe name of SlotsHolder is not suitable because it also handle the memory release. tp_is_gc and some other slots are no need to be override at start, they can inherit from PyType_Type by default. Interop do not holding the delegate objects by calling GetThunk anymore, the SlotsHolder will take care of them. __import__ will restore at shutdown. Does this close any currently open issues? #957 Any other comments? Checklist Check all those that are applicable and complete. Make sure to include one or more tests for your change If an enhancement PR, please create docs and at best an example Add yourself to AUTHORS Updated the CHANGELOG
Open Graph Description: What does this implement/fix? Explain your changes. An upgraded version for #754 An implementation for #957 Also included some minor fixes. Still simple and roughly, reset all GC objects by a save ...
X Description: What does this implement/fix? Explain your changes. An upgraded version for #754 An implementation for #957 Also included some minor fixes. Still simple and roughly, reset all GC objects by a save ...
Opengraph URL: https://github.com/pythonnet/pythonnet/pull/958
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:7cae01f9-e788-c4c9-9bf9-466eb26746da |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 847E:2CECE6:1621F71:1EDF31A:6970D6B9 |
| html-safe-nonce | 1d53b86bb9e1b97e9f996df814e4788107b91b7c638d028e7b8a8ea013f66b46 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDdFOjJDRUNFNjoxNjIxRjcxOjFFREYzMUE6Njk3MEQ2QjkiLCJ2aXNpdG9yX2lkIjoiMzIzNjYzMjQ0NDg3NzcyMzMyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d201f422bca029680d72b4d434736086f474292377c7f5c12af2a6ab3ba2e420 |
| hovercard-subject-tag | pull_request:318432107 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/pythonnet/pythonnet/pull/958/checks |
| twitter:image | https://avatars.githubusercontent.com/u/3406561?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/3406561?s=400&v=4 |
| og:image:alt | What does this implement/fix? Explain your changes. An upgraded version for #754 An implementation for #957 Also included some minor fixes. Still simple and roughly, reset all GC objects by a save ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 034aaee9edccd455c18591b13122193c6e12dc773e8a203be73abe934f3e3a72 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 52d1d534d0b88c64972e852deb460d09b433b8b2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width