Skip to content

Is defer commit.Free() necessary? #209

@shinningstar

Description

@shinningstar

The Object interface has a function called Free() which called libgit2 git_object_free(). Some test cases ( https://github.com/libgit2/git2go/blob/master/remote_test.go#L160) are using defer to call Free() function. However, in function allocObject, it has already used SetFinalizer to cal Free() function (https://github.com/libgit2/git2go/blob/master/object.go#L72).
So, I think the calling defer commit.Free() here is unnecessary, right?

Furthermore, when should I have to call Free() function explicitly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions