func finalizeProblem(p *Problem) { for _, nodes := range p.insts { C.nodes_free(nodes) } p.insts = nil C.problem_free(p.problem) }
func NewProblem() *Problem { cProblem := C.problem_new() problem := &Problem{cProblem} runtime.SetFinalizer(problem, func(p *Problem) { C.problem_free(p.problem) }) return problem }