Welcome to the forum @Atasattari
My first guess would be that there are some repeated allocations which cause the required memory to grow. This is not a problem per se (and it’s impossible to tell without knowing the code that the functions from your include
call internally), but I encountered some issues with Slurm and memory management before, similar to what is described in this thread:
I guess this is also why you have this line?
rand(Distributions.Uniform(0,1)) < thr && GC.gc();
Since you report the script is running fine in the first version, here are a few things that might help to limit the memory consumption (although I doubt that the impact will be that large):
- Your function
make_data
is compiled only for a string, but you could just do theparse(Int, ...)
when you call the function, such that it is already anInt
when passed. - Remove the
N_events::Integer
annotations. Not sure what they are intended to do, but they are not necessary – in the worst case, they will convert some variables to a different type in every iteration of the loop. - Avoid
try
catch
if possible?