示例#1
0
func finalizeProblem(p *Problem) {
	for _, nodes := range p.insts {
		C.nodes_free(nodes)
	}
	p.insts = nil
	C.problem_free(p.problem)
}
示例#2
0
文件: problem.go 项目: sridif/gosvm
func NewProblem() *Problem {
	cProblem := C.problem_new()
	problem := &Problem{cProblem}

	runtime.SetFinalizer(problem, func(p *Problem) {
		C.problem_free(p.problem)
	})

	return problem
}