Hi Bartolomeo,

How are you getting that 600 MB figure? That was about the peak memory 
consumption for me reported by Activity Monitor, but that doesn't 
necessarily mean its all being used. I actually ran the code (twice), and I 
didn't notice it really "accumulating" memory across multiple runs, i.e. 
its not going to allocate and retain 600 MB for each simulation, I think.

Just to check, I ran your code again with include("simulation.jl"), with a 
clean Julia session. Memory usage @ 487MB.
Model = nothing; gc() cleared it down to 426MB

The rest over the baseline memory usage is compiled code, I'm guessing. 
That won't be allocated again.

Thanks,
Iain


On Wednesday, March 11, 2015 at 12:05:08 PM UTC-4, Bartolomeo Stellato 
wrote:
>
> Hi all,
>
> I recently started using Julia for my *Closed loop MPC simulations.* I 
> fond very interesting the fact that I was able to do almost everything I 
> was doing in MATLAB with Julia. Unfortunately, when I started working on 
> more complex simulations I notice a *memory allocation problem*. 
>
> I am using OSX Yosemite and Julia 0.3.6. I attached a MWE that can be 
> executed with include("simulation.jl")
>
> The code executes a single simulation of the closed loop system with a *MPC 
> controller* solving an optimization problem at each time step via *Gurobi 
> interface*. At the end of the simulation I am interested in only *two 
> performance indices* (float numbers).
> The simulation, however, takes more than 600mb of memory and, even if most 
> of the declared variables local to different functions, I can't get rid of 
> them afterwards with the garbage collector: gc()
>
> I analyzed the memory allocation with julia --track-allocation=user and I 
> included the generated .mem files. Probably my code is not optimized, but I 
> can't understand *why all that memory doesn't get deallocated after the 
> simulation*. 
>
> Is there anyone who could give me any explanation or suggestion to solve 
> that problem? I need to perform several of these simulations and it is 
> impossible for me to allocate for each one more than 600mb.
>
>
> Thank you!
>
> Bartolomeo
>
>
>

Reply via email to