René's URL Explorer Experiment


Title: Deleted dotnet object does not get garbage collected · Issue #1872 · pythonnet/pythonnet · GitHub

Open Graph Title: Deleted dotnet object does not get garbage collected · Issue #1872 · pythonnet/pythonnet

X Title: Deleted dotnet object does not get garbage collected · Issue #1872 · pythonnet/pythonnet

Description: Environment Pythonnet version: 3.0.0rc3 Python version: 3.10.5 Operating System: Windows 10 20H2 .NET Runtime: 6.0.6 Details Describe what you were trying to get done. Create dotnet-object and delete it. If I do that a lot I get memory i...

Open Graph Description: Environment Pythonnet version: 3.0.0rc3 Python version: 3.10.5 Operating System: Windows 10 20H2 .NET Runtime: 6.0.6 Details Describe what you were trying to get done. Create dotnet-object and dele...

X Description: Environment Pythonnet version: 3.0.0rc3 Python version: 3.10.5 Operating System: Windows 10 20H2 .NET Runtime: 6.0.6 Details Describe what you were trying to get done. Create dotnet-object and dele...

Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1872

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deleted dotnet object does not get garbage collected","articleBody":"### Environment\r\n\r\n-   Pythonnet version: 3.0.0rc3\r\n-   Python version: 3.10.5\r\n-   Operating System: Windows 10 20H2\r\n-   .NET Runtime: 6.0.6\r\n\r\n### Details\r\n\r\n-   Describe what you were trying to get done.\r\n\r\nCreate dotnet-object and delete it. If I do that a lot I get memory issues. It seems the never get cleared by the Python- or dotnet-gc. This is not a problem in pythonnet 2.5.2\r\n\r\n-   What commands did you run to trigger this issue?\r\n\r\n```python\r\nimport gc\r\nimport clr\r\nimport psutil\r\nimport matplotlib.pyplot as plt\r\nimport System\r\n\r\n# Create dict store count of objects left\r\ntypes = [\r\n    str,\r\n    System.String,\r\n]\r\ntypes = {obj: 0 for obj in types}\r\n\r\nN = 1_000\r\nstr_size = 1_000_000\r\n\r\nmemory_py = [0 for _ in range(N + 2)]\r\nmemory_py[0] = psutil.virtual_memory().used\r\nfor ii in range(N):\r\n    s_py = str('a' * str_size)\r\n    del s_py\r\n    memory_py[ii + 1] = psutil.virtual_memory().used - memory_py[0]\r\n\r\ngc.collect()\r\n# See what types of objects are still present\r\nfor obj in gc.get_objects():\r\n    if type(obj) in list(types.keys()):\r\n        types[type(obj)] += 1\r\nprint(types)\r\nmemory_py[ii + 2] = psutil.virtual_memory().used - memory_py[0]\r\nmemory_py[0] = 0\r\n```\r\n```\r\n{\u003cclass 'str'\u003e: 0, \u003cclass 'System.String'\u003e: 0}\r\n```\r\n```python\r\nmemory_net = [0 for _ in range(N + 2)]\r\nmemory_net[0] = psutil.virtual_memory().used\r\ns_py = str('a' * str_size)\r\nfor ii in range(N):\r\n    s_net = System.String(s_py)\r\n    del s_net\r\n    memory_net[ii + 1] = psutil.virtual_memory().used - memory_net[0]\r\n\r\ngc.collect()\r\n# See what types of objects are still present\r\nfor obj in gc.get_objects():\r\n    if type(obj) in list(types.keys()):\r\n        types[type(obj)] += 1\r\nprint(types)\r\nmemory_net[ii + 2] = psutil.virtual_memory().used - memory_net[0]\r\nmemory_net[0] = 0\r\n```\r\n```\r\n{\u003cclass 'str'\u003e: 0, \u003cclass 'System.String'\u003e: 1000}\r\n```\r\nYou can also visualize the memory consumption:\r\n```python\r\nfig, ax = plt.subplots()\r\nax.plot(memory_py, label='Python object')\r\nax.plot(memory_net, label='DotNet object')\r\nax.legend()\r\nplt.show(fig)\r\n```\r\n![3 0](https://user-images.githubusercontent.com/4509134/178766479-ba480580-a96f-4801-b47a-98bc314a7ec3.png)\r\n\r\nYou can execute the same code with pythonnet 2.5.2 (Python 3.9.13) and get the following figure\r\n\r\n![2 5](https://user-images.githubusercontent.com/4509134/178767059-0e6014ca-8b0f-4fc5-aa48-8c23bc56d13c.png)\r\n\r\n","author":{"url":"https://github.com/m-rossi","@type":"Person","name":"m-rossi"},"datePublished":"2022-07-13T15:12:01.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/1872/pythonnet/issues/1872"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5e2d2a37-fbbe-411b-f87e-f99498d95385
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8120:19E8FE:151A472:1C4EE28:69706824
html-safe-nonce4c952b6eea8fe3316e84c97db345b3e3bfcf93ce4534d5fd1170d40001ae4fff
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTIwOjE5RThGRToxNTFBNDcyOjFDNEVFMjg6Njk3MDY4MjQiLCJ2aXNpdG9yX2lkIjoiMjMzNjE1MDU1NTA4MTA3NDcyNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb3c74a4af4f1cb999d8a98c6f88251b8ffcbd5c0de88e62326acfb8d4c37a664
hovercard-subject-tagissue:1303582921
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonnet/pythonnet/1872/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1d0dbe0714ce9f9e5bce0ff496c797f6d5babe69eee89034c1a05d3640f6a901/pythonnet/pythonnet/issues/1872
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1d0dbe0714ce9f9e5bce0ff496c797f6d5babe69eee89034c1a05d3640f6a901/pythonnet/pythonnet/issues/1872
og:image:altEnvironment Pythonnet version: 3.0.0rc3 Python version: 3.10.5 Operating System: Windows 10 20H2 .NET Runtime: 6.0.6 Details Describe what you were trying to get done. Create dotnet-object and dele...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamem-rossi
hostnamegithub.com
expected-hostnamegithub.com
None9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2
turbo-cache-controlno-preview
go-importgithub.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git
octolytics-dimension-user_id6050430
octolytics-dimension-user_loginpythonnet
octolytics-dimension-repository_id14748123
octolytics-dimension-repository_nwopythonnet/pythonnet
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id14748123
octolytics-dimension-repository_network_root_nwopythonnet/pythonnet
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7d6181066430cc06553c8396ca201e194ae33cb9
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/pythonnet/pythonnet/issues/1872#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fissues%2F1872
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpythonnet%2Fpythonnet%2Fissues%2F1872
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=pythonnet%2Fpythonnet
Reloadhttps://github.com/pythonnet/pythonnet/issues/1872
Reloadhttps://github.com/pythonnet/pythonnet/issues/1872
Reloadhttps://github.com/pythonnet/pythonnet/issues/1872
pythonnet https://github.com/pythonnet
pythonnethttps://github.com/pythonnet/pythonnet
Notifications https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Fork 770 https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Star 5.4k https://github.com/login?return_to=%2Fpythonnet%2Fpythonnet
Code https://github.com/pythonnet/pythonnet
Issues 155 https://github.com/pythonnet/pythonnet/issues
Pull requests 18 https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects 0 https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/pythonnet/pythonnet/security
Please reload this pagehttps://github.com/pythonnet/pythonnet/issues/1872
Insights https://github.com/pythonnet/pythonnet/pulse
Code https://github.com/pythonnet/pythonnet
Issues https://github.com/pythonnet/pythonnet/issues
Pull requests https://github.com/pythonnet/pythonnet/pulls
Discussions https://github.com/pythonnet/pythonnet/discussions
Actions https://github.com/pythonnet/pythonnet/actions
Projects https://github.com/pythonnet/pythonnet/projects
Wiki https://github.com/pythonnet/pythonnet/wiki
Security https://github.com/pythonnet/pythonnet/security
Insights https://github.com/pythonnet/pythonnet/pulse
New issuehttps://github.com/login?return_to=https://github.com/pythonnet/pythonnet/issues/1872
New issuehttps://github.com/login?return_to=https://github.com/pythonnet/pythonnet/issues/1872
Deleted dotnet object does not get garbage collectedhttps://github.com/pythonnet/pythonnet/issues/1872#top
https://github.com/m-rossi
https://github.com/m-rossi
m-rossihttps://github.com/m-rossi
on Jul 13, 2022https://github.com/pythonnet/pythonnet/issues/1872#issue-1303582921
https://user-images.githubusercontent.com/4509134/178766479-ba480580-a96f-4801-b47a-98bc314a7ec3.png
https://user-images.githubusercontent.com/4509134/178767059-0e6014ca-8b0f-4fc5-aa48-8c23bc56d13c.png
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.