Skip to content
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

Finalizer for Env #7

Closed
yeesian opened this issue Oct 19, 2014 · 1 comment · Fixed by #8
Closed

Finalizer for Env #7

yeesian opened this issue Oct 19, 2014 · 1 comment · Fixed by #8
Assignees

Comments

@yeesian
Copy link
Collaborator

yeesian commented Oct 19, 2014

similar to jump-dev/Gurobi.jl#24.

Currently KNITRO.jl doesn't call freeProblem in the finalizer; I haven't found a way to make it work. The relevant lines:

(lines 57-62 in src/KNITRO.jl)

   function KnitroProblem()
       prob = new(newcontext())
       # finalizer segfaults upon termination of the running script
       # finalizer(prob, freeProblem)
       prob
   end

and

(lines 67-70 in src/KNITRO.jl)

   function freeProblem(kp::KnitroProblem)
       freecontext(kp.env)
       #kp.env = C_NULL
   end

cc @IainNZ @mlubin

@IainNZ
Copy link

IainNZ commented Oct 19, 2014

Can you add some printlns to figure out which line segfaults? I don't see why that would segfault unless you try to operate on the env after freeing it.

@yeesian yeesian self-assigned this Oct 19, 2014
yeesian added a commit that referenced this issue Oct 19, 2014
[WIP] finalize using freeProblem. Closes #7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants