I’m working on a laptop with 24GB of memory and solving the scalar Helmholtz equation with a 0 right-hand side using NewtonMinimization. I was running into memory limits in 3D when trying to get the precision I needed, so I decided to try 2D for the particular question I was looking at involving small changes of geometry. In 3D, roughly 500,000 degrees of freedom was close to my memory limit.

To my great surprise, my memory is completely filling up and causing my script to fail with a segmentation fault with only 716 degrees of freedom in 2D after adaptive meshing. I can start with a much smaller maxh and successfully run NewtonMinimization with 836 degrees of freedom, so the adaptive meshing seems somehow related.

Is there something obvious I’m missing, or are there debug tools I can use to find where in NewtonMinimization’s source the memory overflow is happening?

Thanks for any tips. I’ve attached examples that illustrate the two cases I described.

mwe.py (4.2 KB)

mwe_output.txt (27 Bytes)

mwe_works.py (4.3 KB)

mwe_works_output.txt (638 Bytes)