-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Attach finalizers to LibGit2 methods #19660
Conversation
The alternative here, of course, is to actually add these methods as finalizers to the relevant objects: this would probably make more sense in the long run (as a benefit, we wouldn't need to then deprecate the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this lgtm for now. be sure to squash
@wildart Do you know why we don't use object finalizers for these? |
ace5716
to
f790e88
Compare
I've cleaned this up so that most now actually act like finalizers. This can't be used for |
seems to cause Pkg issues, see the travis log |
fdd25fa
to
ead1e44
Compare
Okay, hopefully this should be good. |
ccall((:git_object_free, :libgit2), Void, (Ptr{Void},), obj.ptr) | ||
obj.ptr = C_NULL | ||
|
||
macro defclose(typ,cname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, no: was left over from my refactoring
(:GitTree, :GitRepo, :GitObject, :git_tree), | ||
(:GitTag, :GitRepo, :GitObject, :git_tag)] | ||
|
||
if reporef == nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
===
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
ead1e44
to
455063b
Compare
455063b
to
4bf63fe
Compare
end | ||
[GitAnnotated(repo, tr_brn_ref)] | ||
end | ||
tr_brn_ref = upstream(head_ref) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upstream(head(repo))
? does this not need with(head(repo))
any more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, something got broken in the rebase. I'll try to figure out what happened.
Okay, I think this is ready. |
Are there any requirements from libgit2 that objects should be freed "quickly" as they are when using the |
Not that I can tell, no. In fact, we could probably clean up the code quite a bit by getting rid of all the |
Unless I guess anything on the C side holds open file handles that we'd like to delete or similar? |
That could be, but the libgit2 docs are pretty sparse in that regard. |
Fixes #17414.