# Julia slowdown on long running programs with many allocations

**URL:** <https://discourse.julialang.org/t/julia-slowdown-on-long-running-programs-with-many-allocations/63516>\
**Category:** Performance\
**Tags:** memory-allocation, flux\
**Created:** [June 24, 2021, 10:07pm UTC](https://discourse.julialang.org/t/julia-slowdown-on-long-running-programs-with-many-allocations/63516 "2021-06-24T22:07:48Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![scottjordan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scottjordan/32/26096_2.png) [@scottjordan](https://discourse.julialang.org/u/scottjordan)\
**Post date:** [July 6, 2021, 1:52pm UTC](https://discourse.julialang.org/t/julia-slowdown-on-long-running-programs-with-many-allocations/63516/6 "2021-07-06T13:52:33Z")

</div>

Thanks for the responses. There are only a few places to reduce allocations further because most of them happen in the Flux model and gradient calls. I was not able to reliably replicate the exact behavior, but the issue was resolved by adding the line

```julia
GC.gc(true)

```

after each `optimize_model!` call.

---

_[View the full topic](https://discourse.julialang.org/t/julia-slowdown-on-long-running-programs-with-many-allocations/63516)._
