libgmsh memory management affects performance of program using it
Hi!
I have noticed that calling gmsh::finalize
slow down my programs that make calculations on meshes read with the API. I can reproduce the issue with yesterday's automatic snapshot, but I noticed it with libgmsh-dev 3.0.6 packaged for ubuntu 20.04.
To nail the issue down, I followed the codepaths of the functions being called by gmsh::finalize
and commented them out, one at a time, to figure out what was slowing down my programs. I spotted first DeleteAllModelsAndViews
and then GFace::deleteMesh
as the cause of the drop in performance. Specifically, for my test consisting of quadrangles, most of the slowdown was due to this line: https://gitlab.onelab.info/gmsh/gmsh/-/blob/master/Geo/GFace.cpp#L143.
That line apparently simply calls delete
on a pointer argument. Does Gmsh have any sort of memory pool?
I know very little of memory management. I have also asked for help in the gcc-help list: https://gcc.gnu.org/pipermail/gcc-help/2021-May/140315.html.
Do you have any idea of why freeing the memory used by Gmsh is influencing my programs?
I have noted the issue even with small models made up of only 10 000 cells.
I can prepare a testcase. It would require GCC 11 and any version of range-v3. Is that a problem?