title: GEKKO "Memory allocation failed"
body: <p>I'm trying to use <a href="https://gekko.readthedocs.io/en/latest/" rel="nofollow noreferrer">GEKKO</a> to solve quite a large optimization problem locally (with <code>remote=False</code>).</p>
  <p>When running the code, I get the error:</p>
  <pre><code>Error: At line 463 of file custom.f90
  Traceback: not available, compile with -ftrace=frame or -ftrace=full
  Operating system error: Not enough memory resources are available to process this command.
  
  Memory allocation failed
  </code></pre>
  <p>So that hints that the operating system doesn't let GEKKO use enough memory.</p>
  <p>However, I'm using a 32GB RAM machine, with nearly 25 GB free, while the model probably don't even need 10GB.</p>
  <p>I've tried using <code>m.options.MAX_MEMORY = 10</code>, but this doesn't seem to matter.</p>
  <blockquote>
  <p><strong>Any thoughts on how to allow it to allocate more memory?</strong></p>
  </blockquote>
  <p>Here is some (simplified) code that triggers this error:</p>
  <pre><code>from gekko import GEKKO
  
  quantiles = [(x+1)*.01 for x in range(300)]
  
  #Initialize Model
  m = GEKKO(remote=False)
  #Set global options
  m.options.IMODE = 3 #steady state optimization    
  m.options.SOLVER=3
  m.options.MAX_ITER=100000
  m.options.MAX_MEMORY = 10
  m.options.REDUCE=10
  
  #initialize variables
  Est_array = m.Array(m.Var,(2, 16),value=1,lb=0,ub=48)
  P_ij_t = m.Array(m.Var,(4, 16, 300), lb=0, ub=1)   
  Exp_ij_t = m.Array(m.Var,(4, 16, 300),value=1,lb=-36,ub=36)   
  C_t = m.Array(m.Var,300,lb=0,ub=5) 
  
  #Equations
  for h in range(16): 
      for q in range(300):
          m.Equation(m.sum([P_ij_t[i,h,q] for i in range(3)]) == 1)
  
  for (q,t) in enumerate(quantiles):
      m.Equation(C_t[q] == (  m.sum([P_ij_t[i+2,h,q]*(Est_array[i,h]-t)**2 for i in range(2) for h in range(16)]) + \
                              m.sum([P_ij_t[i,h,q]*(Est_array[1-i,15-h]-t)**2 for i in range(2) for h in range(16)]) 
      )  
      )
     
  #Objective
  m.Minimize(C_t[0])
  
  #Solve simulation
  #m.open_folder() 
  m.solve()
  
  #Results
  print('C = ' + str(C_t[0].value[0]))
  </code></pre>
  <hr />
  <p>(All of the <code>m.options.*</code> parameters are things that I tried to get the solver to run, but none seem to help with the memory allocation problem).</p>