Free Git objects via finalizers or manually #3
Loading…
Reference in New Issue
No description provided.
Delete Branch "finalizers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Provide a manual way of freeing objects, but set finalizers for them
in case the user does not want to worry about memory management, which
would be useful for commits or trees, which sare typically small.
When the objects are freed manually, the finalizer is unset to avoid
double-freeing, mimicking what the go runtime does.
This is what I was saying earlier. Through some magic that I can't quite remember, doing the
(*Type).Free
thing lets us have the same function for both manual and automatic freeing. There's bound to be some cost to calling into theruntime
package. Though unlikely, if this becomes a problem, we could look into setting the pointer tonil
inFree()
and exit if it's alreadynil
, like we do in C. But I think we'll cross that bridge when we get to it.Very very neat. Let's see if this segfaults tho. :)
Only one way to find out!