Pymesh boolean union memory leak

334 views Asked by At

I got an error when trying to run pymesh.boolean function inside a loop. I have a loop with pymesh meshes and boolean union operation inside. The error occurs in pymesh/boolean.py in engine.compute_union() and causes a MemoryError: std::bad_alloc

  result = pymesh.boolean(meshes[0], meshes[1], "union")

  for mesh in meshes:
    result = pymesh.boolean(final_mesh, mesh, "union")

Installed pymesh from https://hub.docker.com/r/pymesh/pymesh

Thanks in advance for any help!

1

There are 1 answers

3
del On

I'm having the same issue, although I used the CSG tree to run the boolean union, but I assume it does the same boolean operation.

In my case I'm doing a boolean on two stl files, one of which is a 20MB weird model (basically it's a human with hair and the hair has no volume, it's just lots of triangles making up 2D lines) and I suspect the pymesh goes crazy when it encounters that file (though I can't say for sure). Docker stops with exit code 137 (which might come from docker killing the process because it uses too much memory).

Does your file have anything out of the ordinary? What docker image are you using?

It might be worth opening an issue on the pymesh github repo.

I'm using the pymesh/pymesh:py3.7 docker image on a 2GB RAM Debian host machine