Skip to content
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

[BUG] Memory issues when using the solver for multiple registration attempts #30

Open
fdila opened this issue Feb 27, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@fdila
Copy link
Contributor

fdila commented Feb 27, 2025

Hi!
first of all: I don't know if this is a bug or if I'm not doing something properly.

I need to use the KISS matcher to align multiple pointclouds, like in a loop, but after a couple hundreds of alignments I get the error

double free or corruption (!prev)
Aborted (core dumped)

This is a snippet to reproduce my error, I took the examples/run_kiss_matcher.py script and instead of solving the registration one time I do it in a loop for a thousand times. After a non-deterministic amout of iterations I get the error copied above.
Snippet:

    params = kiss_matcher.KISSMatcherConfig(args.resolution)
    matcher = kiss_matcher.KISSMatcher(params)
    for i in range(1000):     
        result = matcher.estimate(src, tgt)
        matcher.clear()
        matcher.reset()
        matcher.reset_solver()
        print(i)

As show above, I'm clearing and resetting the matcher object, but maybe it is not enough to completely clear the internal state?

I tried to do the same thing in cpp and apparently there is no memory bug there, so I guess it has something to do with the pybiding. I tried to search in the pybinding repo issues and there are other people complaining about similar problems, but I haven't been able to pinpoint what exactly is making the python script crash.

@fdila fdila added the bug Something isn't working label Feb 27, 2025
@LimHyungTae
Copy link
Member

Oh thanks for reporting!

Hmm...that looks off, but occasionally, I also saw that error. Could you run the code like this?

    params = kiss_matcher.KISSMatcherConfig(args.resolution)
   
    for i in range(1000):     
        matcher = kiss_matcher.KISSMatcher(params)
        result = matcher.estimate(src, tgt)
        matcher.clear()
        matcher.reset()
        matcher.reset_solver()
        print(i)

@LimHyungTae
Copy link
Member

In the case of Python, at which iteration does the error occur?

@LimHyungTae
Copy link
Member

Hmmm...bro I tested python by running KISS-Matcher multiple time; but there are no memory issues. Could you check your data carefully? Because you acquired very noisy data, right? Or if it is possible, you can share your python script and data with me.

@fdila fdila changed the title [BUG] Memory issues with pybindings when using the solver for multiple registration attempts [BUG] Memory issues when using the solver for multiple registration attempts Feb 28, 2025
@fdila
Copy link
Contributor Author

fdila commented Feb 28, 2025

My bad, apparently it's happening also with the "pure" cpp code, at least there is one less layer (pybinding) to worry about.
Attached there is the cpp code.
I'm using the test data provided: ./run_kiss_matcher data/Vel16/src.pcd data/Vel16/tgt.pcd 0.3
It happens pretty randomly, it happened at the 52 iteration, at the 218, at 357, at 673, sometimes it does not happen at all.
I must say I am pretty confused about the randomness of this bug.

Just in case here is a video proving I'm not going mad: https://drive.google.com/file/d/1V_3Un0wdeE0gZWq2ECEtALP-G2xTMjde/view?usp=sharing

run_kiss_matcher.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants