-
Notifications
You must be signed in to change notification settings - Fork 19
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
"double free or corruption (!prev)" in quadric_simplify_mesh #6
Comments
I am unable to replicate this issue. This project takes a NIfTI volume as input, not an obj file. Can you create a github repository with your source project to demonstrate some issues, and also provide details regarding the computer and compiler used (e.g. MacOS with gcc). This code is a pure C implementation of this C++ code that creates a minimal tool for simplifying obj meshes. It does not exhibit the behavior you describe (on a Windows computer with the cl compiler). |
I am currently using the C++ implementation here but would happily swap it for a C implementation so I wrote another MEX wrapper around |
@gllmflndn I have been able to replicate and fix your issue. To replicate and de-bug the issue I added the
This revealed that the refs array was too small to grow. In my C code, I pre-allocate this array with a worst case scenario size as there is a big performance penalty for growing its size. Clearly, my calculation for worst case scenario was not conservative enough, so I increased the buffer and the code now works without any memory exceptions and to a nice completion. |
Thanks @neurolabusc I confirm that with your fix I could reduce my example mesh for any value between 20480 and 1 and it ran smoothly. On a very minor note, I notice a warning when compiling with
It's not a very pertinent warning here but I silence it with |
Thanks! I am closing this issue. The sphere is an interesting edge case in that initially all vertices have identical collapse costs. |
With the exemplar attached mesh (20480 faces), quadric_simplify_mesh runs successfully at reducing the number of faces from 20479 to 3750 but crashes when requesting 3749 faces (
aggressiveness
set to7.0
):sphere.zip
The text was updated successfully, but these errors were encountered: