# Delete a JuMP model entirely

**URL:** https://discourse.julialang.org/t/delete-a-jump-model-entirely/19895
**Category:** Optimization (Mathematical)
**Created:** [January 21, 2019, 9:28pm UTC](https://discourse.julialang.org/t/delete-a-jump-model-entirely/19895 "2019-01-21T21:28:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Rasoul](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@Rasoul](https://discourse.julialang.org/u/Rasoul)
#### Post date: [January 21, 2019, 9:28pm UTC](https://discourse.julialang.org/t/delete-a-jump-model-entirely/19895/1 "2019-01-21T21:28:25Z")

</div>

Hi All,

Is there any way to delete a JuMP model after solving it? I have to call a function repeatedly to solve my problem but after the first call, I get the following error for every single variable in the model. Please let me know how can I solve this issue. Thanks in advance!

```julia
Warning: A variable or constraint named td is already attached to this model. If creating variables programmatically, use the anonymous variable syntax x = @variable(m, [1:N], ...).

```

All the best,  
Rasoul

---

<div class="post-metadata">

### Author: ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)
#### Post date: [January 21, 2019, 9:57pm UTC](https://discourse.julialang.org/t/delete-a-jump-model-entirely/19895/2 "2019-01-21T21:57:07Z")

</div>

A JuMP model is a Julia object like anything else. It’s deleted by the garbage collector at some time after there are no more references to it ([Frequently Asked Questions · The Julia Language](https://docs.julialang.org/en/v1/manual/faq/#How-do-I-delete-an-object-in-memory?-1)).

> [@Rasoul](#):
>
> I have to call a function repeatedly to solve my problem but after the first call, I get the following error for every single variable in the model.

It sounds like you want to pass a new model to the function on each call instead of reusing the same one.

---

<div class="post-metadata">

### Author: ![Rasoul](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@Rasoul](https://discourse.julialang.org/u/Rasoul)
#### Post date: [January 22, 2019, 2:43pm UTC](https://discourse.julialang.org/t/delete-a-jump-model-entirely/19895/3 "2019-01-22T14:43:42Z")

</div>

Thanks for the response! It was useful.  
I had already tried to delete variables by the same procedure but I couldn’t. Deleting the entire model works for me.

All the best,  
Rasoul
