René's URL Explorer Experiment


Title: context/data: memleak due to API (mis)use by bradh352 · Pull Request #131 · CESNET/libyang-python · GitHub

Open Graph Title: context/data: memleak due to API (mis)use by bradh352 · Pull Request #131 · CESNET/libyang-python

X Title: context/data: memleak due to API (mis)use by bradh352 · Pull Request #131 · CESNET/libyang-python

Description: Memory management is a foreign concept to python in general, however it appears DNode and Context require .free() and .destroy() to be called, respectively, to avoid a memory leak. This seems easily avoidable by simply attaching a destructor to the class so the python garbage collector can clean up automatically when all references go out of scope. We add a reference to any DNode object derived from another DNode object (but not duplicated) so we can determine if we are allowed to be the one to destroy the DNode cdata, as well as to keep proper reference counting in case the owner goes out of scope but a dependent reference is still in scope. This change should also be compatible with existing integrations which may be aware of this as it sets the internal cdata reference to None and checks it to ensure it doesn't run the cleanup again. That said, I think calling DNode.free() in this case is still risky since there are no checks to ensure this is truly valid like the destructor does. Signed-off-by: Brad House (@bradh352)

Open Graph Description: Memory management is a foreign concept to python in general, however it appears DNode and Context require .free() and .destroy() to be called, respectively, to avoid a memory leak. This seems easil...

X Description: Memory management is a foreign concept to python in general, however it appears DNode and Context require .free() and .destroy() to be called, respectively, to avoid a memory leak. This seems easil...

Opengraph URL: https://github.com/CESNET/libyang-python/pull/131

X: @github

direct link

Domain: patch-diff.githubusercontent.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:ab2bdb20-8ed7-650c-37e8-68066a36186c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idAF2A:17CBF3:3DEE80:54F645:698E0DA5
html-safe-nonce5413a98410759e37dc8d04f7d9aa59670e4ffc5dc41adcdacd011898bde32761
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjJBOjE3Q0JGMzozREVFODA6NTRGNjQ1OjY5OEUwREE1IiwidmlzaXRvcl9pZCI6Ijc5OTAxNDczMzcyMTIwMDU3OTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac20401f35b70cc50ca2f219b615f13862735c09454779546ef9265bb5dc4917c4
hovercard-subject-tagpull_request:2319998081
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/CESNET/libyang-python/pull/131/files
twitter:imagehttps://avatars.githubusercontent.com/u/19732188?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/19732188?s=400&v=4
og:image:altMemory management is a foreign concept to python in general, however it appears DNode and Context require .free() and .destroy() to be called, respectively, to avoid a memory leak. This seems easil...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonefdf74c91c9ac187cc5cd7b14d4af2d6ef3e18136d002f5d36253f8538e97ee4c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/CESNET/libyang-python git https://github.com/CESNET/libyang-python.git
octolytics-dimension-user_id1116469
octolytics-dimension-user_loginCESNET
octolytics-dimension-repository_id275748507
octolytics-dimension-repository_nwoCESNET/libyang-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id275748507
octolytics-dimension-repository_network_root_nwoCESNET/libyang-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1a5a3e7bbfb3486980e340c242368684156fba87
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FCESNET%2Flibyang-python%2Fpull%2F131%2Ffiles
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://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2FCESNET%2Flibyang-python%2Fpull%2F131%2Ffiles
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=CESNET%2Flibyang-python
Reloadhttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
Reloadhttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
Reloadhttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
CESNET https://patch-diff.githubusercontent.com/CESNET
libyang-pythonhttps://patch-diff.githubusercontent.com/CESNET/libyang-python
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2FCESNET%2Flibyang-python
Fork 53 https://patch-diff.githubusercontent.com/login?return_to=%2FCESNET%2Flibyang-python
Star 67 https://patch-diff.githubusercontent.com/login?return_to=%2FCESNET%2Flibyang-python
Code https://patch-diff.githubusercontent.com/CESNET/libyang-python
Issues 15 https://patch-diff.githubusercontent.com/CESNET/libyang-python/issues
Pull requests 2 https://patch-diff.githubusercontent.com/CESNET/libyang-python/pulls
Actions https://patch-diff.githubusercontent.com/CESNET/libyang-python/actions
Security 0 https://patch-diff.githubusercontent.com/CESNET/libyang-python/security
Insights https://patch-diff.githubusercontent.com/CESNET/libyang-python/pulse
Code https://patch-diff.githubusercontent.com/CESNET/libyang-python
Issues https://patch-diff.githubusercontent.com/CESNET/libyang-python/issues
Pull requests https://patch-diff.githubusercontent.com/CESNET/libyang-python/pulls
Actions https://patch-diff.githubusercontent.com/CESNET/libyang-python/actions
Security https://patch-diff.githubusercontent.com/CESNET/libyang-python/security
Insights https://patch-diff.githubusercontent.com/CESNET/libyang-python/pulse
Sign up for GitHub https://patch-diff.githubusercontent.com/signup?return_to=%2FCESNET%2Flibyang-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://patch-diff.githubusercontent.com/login?return_to=%2FCESNET%2Flibyang-python%2Fissues%2Fnew%2Fchoose
bradh352https://patch-diff.githubusercontent.com/bradh352
CESNET:masterhttps://patch-diff.githubusercontent.com/CESNET/libyang-python/tree/master
bradh352:gc-fixeshttps://patch-diff.githubusercontent.com/bradh352/libyang-python/tree/gc-fixes
Conversation 4 https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131
Commits 2 https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/commits
Checks 10 https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/checks
Files changed https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
Please reload this pagehttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
context/data: memleak due to API (mis)use https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#top
Show all changes 2 commits https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
6a03544 context/data: memleak due to API (mis)use bradh352 Feb 6, 2025 https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/commits/6a03544166fb5e9f658876d996dfd1f1882fb45b
09c4b42 clarification bradh352 Feb 6, 2025 https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/commits/09c4b42473e399816d00345fa25d1db42d69e842
Clear filters https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
Please reload this pagehttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
Please reload this pagehttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
context.py https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
data.py https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-c6c88d2d1d1cc94884356f5da77631ab8fa116d68476b07baaeaa0649147ee37
libyang/context.pyhttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
View file https://patch-diff.githubusercontent.com/CESNET/libyang-python/blob/09c4b42473e399816d00345fa25d1db42d69e842/libyang/context.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/{{ revealButtonHref }}
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
https://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files#diff-eb6b93614652a23f376460d4c8397da4ef96b42c639c9cb3a3dc6ac408c8b8e6
Please reload this pagehttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
Please reload this pagehttps://patch-diff.githubusercontent.com/CESNET/libyang-python/pull/131/files
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.