-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory hungry straightSkeleton #502
Comments
Adding some debugging lines I find this:
I'm don't know what those huge numbers (18446....) mean, they are printed feeding capacity_of_{halfedges,faces,vertices}() to std::cout. |
The final "bytes" report is |
I've found bytes_reserved to just be a proxy to bytes():
|
Ok and max_size is std::list::max_size, so just a theoretical limit of the addressing of memory itself: http://www.cplusplus.com/reference/list/list/max_size/ So we theoretically have ~8MB of size for the half-edges, faces and vertices elements of the straight skeleton, but empirically the process eats up to 16GB, where else could the memory be ? Could it be boost internal caches ? |
Valgrind (massif tool) reports total memory to be under 500MB:
Some stats about the last snapshot:
|
why invalid ? |
I see 16GB used by the system monitor. Not sure where they come from, but they are taken up before the end of skeleton construction. Could be boost caches ? If so, any idea about how to disable them ? |
Hello. Sorry for the late response but I just got back from a bussiness trip to Detroit. This large memory consumption might be expected, and the "culprit" would be the priority-queue that is used to hold all potential events. Roughly speaking the algorithm requires quadratric storage (it isn't exactly that but close). Unlike many other geometric algorithms, this need to compute ALL potential split events for each reflex vertex and store them all in a priority queue. Almost ALL edges would have a potential split again any reflex vertex, so, we are facing an upper bound around of 10K x 10K split events on the PQ (that's estimating that 10K of the vertices are reflex and 10K of the edges produce a potential split event). On top of that add the space used to compute about 14K edge-events, plus all skeleton nodes, halfedges and faces (this part is signigicantly less memory consuming that the events PQ). |
According to this explanation, this memory usage is expected and not a bug (although I understand this might be a limitation of the algorithm). I am closing the issue, please open a pull request if a better solution that requires less memory can be proposed. |
As reported in Oslandia/SFCGAL#118 I've a polygon with ~14k vertices in 362 rings (4.5K vertices in the shall, the others all in holes) that make the straightSkeleton computer use up to 16GB of RAM. This may or may not be expected, but I hadn't found documentation of space complexity for the CGAL algorithm.
@fcacciola is there any way to predict the amount of memory needed for a given input ?
The text was updated successfully, but these errors were encountered: