René's URL Explorer Experiment


Title: Diff Memory leaks - Expose git_diff_free · Issue #1541 · nodegit/nodegit · GitHub

Open Graph Title: Diff Memory leaks - Expose git_diff_free · Issue #1541 · nodegit/nodegit

X Title: Diff Memory leaks - Expose git_diff_free · Issue #1541 · nodegit/nodegit

Description: I'm running a script that check a repo for Diff.indexToWorkdir every interval, like so: // runs in interval every 1s .then(() => { return git.Repository.open('../my_repo_path'); }) .then( (repo) => { return git.Diff.indexToWorkdir(repo);...

Open Graph Description: I'm running a script that check a repo for Diff.indexToWorkdir every interval, like so: // runs in interval every 1s .then(() => { return git.Repository.open('../my_repo_path'); }) .then( (repo) =>...

X Description: I'm running a script that check a repo for Diff.indexToWorkdir every interval, like so: // runs in interval every 1s .then(() => { return git.Repository.open('../my_repo_path'); }) ....

Opengraph URL: https://github.com/nodegit/nodegit/issues/1541

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Diff Memory leaks - Expose git_diff_free","articleBody":"I'm running a script that check a repo for `Diff.indexToWorkdir` every interval, like so:\r\n```js\r\n   // runs in interval every 1s\r\n    .then(() =\u003e {\r\n        return git.Repository.open('../my_repo_path');\r\n    })\r\n    .then( (repo) =\u003e {\r\n      return git.Diff.indexToWorkdir(repo);\r\n    })\r\n    .then((repoDiff) =\u003e {\r\n        return repoDiff.toBuf(git.Diff.FORMAT.PATCH);\r\n    })\r\n```\r\nThis generates a memory leak.\r\n\r\nI know the repository needs to be freed using `repo.free()`: (or `repo.cleanup()`)\r\nhttps://www.nodegit.org/api/repository/#free\r\n\r\nAccording to the docs:\r\nhttps://libgit2.org/libgit2/#HEAD/group/repository/git_repository_free\r\n\r\n\u003e Note that after a repository is free'd, all the objects it has spawned **will still exist until they are manually closed by the user with git_object_free**, but accessing any of the attributes of an object without a backing repository will result in undefined behavior\r\n\r\nWhich means I also need to free up the Diff object;\r\nApparently there's a way to free a diff using `git_diff_free`\r\nhttps://libgit2.org/libgit2/#HEAD/group/diff/git_diff_free\r\n\r\nBut from what I understand nodegit doesn't expose this function, see:\r\nhttps://github.com/nodegit/nodegit/blob/c944ec6ae5c8fffbac8db7b1f0180ae1254560f2/generate/input/descriptor.json#L933-L935\r\n\r\n**EDIT**\r\nIt seems like I also need to free up the `Buf` I'm creating using `repoDiff.toBuf(git.Diff.FORMAT.PATCH);`\r\nhttps://www.nodegit.org/api/buf/#free\r\nhttps://libgit2.org/libgit2/#HEAD/group/buf/git_buf_free\r\n\r\nBut I didn't find a way to do this since `repoDiff.toBuf` return a Promise which returns a string.\r\nIt seems the `Buf` is only available in the C++ implementation. (see NAN_METHOD(GitDiff::ToBuf) )\r\n\r\nIs there another way to do this?\r\nThanks\r\n\r\nBTW, I'm guessing this also relates to: https://github.com/nodegit/nodegit/issues/766","author":{"url":"https://github.com/yelled3","@type":"Person","name":"yelled3"},"datePublished":"2018-08-21T13:44:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/1541/nodegit/issues/1541"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c59c6944-1184-57e0-a349-d2cd2ebf760d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id95B4:C5156:F0C91:14695D:6A5FE73D
html-safe-nonceee90ae7d24d419d846c2ec6f0edc50213a21da70c188d84f4f66889212c3c30d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUI0OkM1MTU2OkYwQzkxOjE0Njk1RDo2QTVGRTczRCIsInZpc2l0b3JfaWQiOiIxMjE0ODg2NDcyNzQ0NjkxNTE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3f085d7628b722432e77f5213a621606f2f78db773fcbbe43e9150ce3e61e095
hovercard-subject-tagissue:352544419
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/nodegit/nodegit/1541/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bffc2d8b6e1ff7caf1ae8a7d18de4e92ae7d0d36d6ec7cc302290507f0b86657/nodegit/nodegit/issues/1541
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bffc2d8b6e1ff7caf1ae8a7d18de4e92ae7d0d36d6ec7cc302290507f0b86657/nodegit/nodegit/issues/1541
og:image:altI'm running a script that check a repo for Diff.indexToWorkdir every interval, like so: // runs in interval every 1s .then(() => { return git.Repository.open('../my_repo_path'); }) .then( (repo) =>...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameyelled3
hostnamegithub.com
expected-hostnamegithub.com
None78938542173c0d8e4ad1aefc7954896e81c10ce2620286603ef14cf593bd5a11
turbo-cache-controlno-preview
go-importgithub.com/nodegit/nodegit git https://github.com/nodegit/nodegit.git
octolytics-dimension-user_id657068
octolytics-dimension-user_loginnodegit
octolytics-dimension-repository_id1383170
octolytics-dimension-repository_nwonodegit/nodegit
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1383170
octolytics-dimension-repository_network_root_nwonodegit/nodegit
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
release1a427601e09953033b696253e754ebc7328096a7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodegit/nodegit/issues/1541#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodegit%2Fnodegit%2Fissues%2F1541
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
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
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
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
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
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/enterprise/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%2Fnodegit%2Fnodegit%2Fissues%2F1541
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=nodegit%2Fnodegit
Reloadhttps://github.com/nodegit/nodegit/issues/1541
Reloadhttps://github.com/nodegit/nodegit/issues/1541
Reloadhttps://github.com/nodegit/nodegit/issues/1541
Please reload this pagehttps://github.com/nodegit/nodegit/issues/1541
nodegit https://github.com/nodegit
nodegithttps://github.com/nodegit/nodegit
Notifications https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Fork 698 https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Star 5.8k https://github.com/login?return_to=%2Fnodegit%2Fnodegit
Code https://github.com/nodegit/nodegit
Issues 343 https://github.com/nodegit/nodegit/issues
Pull requests 20 https://github.com/nodegit/nodegit/pulls
Actions https://github.com/nodegit/nodegit/actions
Projects https://github.com/nodegit/nodegit/projects
Security and quality 0 https://github.com/nodegit/nodegit/security
Insights https://github.com/nodegit/nodegit/pulse
Code https://github.com/nodegit/nodegit
Issues https://github.com/nodegit/nodegit/issues
Pull requests https://github.com/nodegit/nodegit/pulls
Actions https://github.com/nodegit/nodegit/actions
Projects https://github.com/nodegit/nodegit/projects
Security and quality https://github.com/nodegit/nodegit/security
Insights https://github.com/nodegit/nodegit/pulse
Diff Memory leaks - Expose git_diff_freehttps://github.com/nodegit/nodegit/issues/1541#top
in progresshttps://github.com/nodegit/nodegit/issues?q=state%3Aopen%20label%3A%22in%20progress%22
https://github.com/yelled3
yelled3https://github.com/yelled3
on Aug 21, 2018https://github.com/nodegit/nodegit/issues/1541#issue-352544419
https://www.nodegit.org/api/repository/#freehttps://www.nodegit.org/api/repository/#free
https://libgit2.org/libgit2/#HEAD/group/repository/git_repository_freehttps://libgit2.org/libgit2/#HEAD/group/repository/git_repository_free
https://libgit2.org/libgit2/#HEAD/group/diff/git_diff_freehttps://libgit2.org/libgit2/#HEAD/group/diff/git_diff_free
nodegit/generate/input/descriptor.jsonhttps://github.com/nodegit/nodegit/blob/c944ec6ae5c8fffbac8db7b1f0180ae1254560f2/generate/input/descriptor.json#L933-L935
c944ec6https://github.com/nodegit/nodegit/commit/c944ec6ae5c8fffbac8db7b1f0180ae1254560f2
https://www.nodegit.org/api/buf/#freehttps://www.nodegit.org/api/buf/#free
https://libgit2.org/libgit2/#HEAD/group/buf/git_buf_freehttps://libgit2.org/libgit2/#HEAD/group/buf/git_buf_free
#766https://github.com/nodegit/nodegit/issues/766
in progresshttps://github.com/nodegit/nodegit/issues?q=state%3Aopen%20label%3A%22in%20progress%22
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.