0

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 Answers1

0

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

del
  • 1
  • 2
  • I'm starting to suspect that it's just a memory issue. try allocating more memory to the docker container: `docker run --memory=5g` – del Apr 29 '20 at 15:55
  • Yep, I have the same models - humans, hair is like one single mesh. I tried CSG tree as well - in both cases, I got 134 error on a local machine with pymesh/pymesh:py3.6 I'm using an AWS instance with 16GB of ram. This instance doesn't show me 134, but sometimes I can catch an error - MemoryError: std::bad_alloc inside a Pymesh lib. Usually, this shouldn't break a 16GB... so I think there some problem with boolean and maybe a lot of calculation and what triggers pymesh infinity loop inside his engine until the memory leak breaks it. But I'm not sure about that. – Eleores Michael Apr 29 '20 at 19:39
  • I'm runnng the boolean union as a worker process, so I would need it to not crash. Maybe if the boolean operation runs as a subprocess (maybe with a memory limit) that could be a temporary workaround. I raised an [issue](https://github.com/PyMesh/PyMesh/issues/232); let's see what happens – del Apr 30 '20 at 20:32