libtest-mimic icon indicating copy to clipboard operation
libtest-mimic copied to clipboard

Avoid memory leaks

Open Felix-El opened this issue 1 year ago • 1 comments

This commit replaces the threadpool crate with a handcrafted solution based on scoped threads. This leaves valgrind much happier than before. We also lose some dependency baggage.

Closes #45

Felix-El avatar Aug 16 '24 11:08 Felix-El

@hanna-kruppe, many thanks you for your review. Appreciate you took the time to look in-depth. I've refactored my approach a couple of times before my initial commit. Actually I've been there before, at roughly what you proposed above. Anyway, I hope the update resonates better with you and an authority.

Felix-El avatar Aug 18 '24 23:08 Felix-El

Due to me not being able to push to your branch, I had to merge manually, which (paired with a rebase), github does not recognize. But here, your changes are merged: https://github.com/LukasKalbertodt/libtest-mimic/commit/d194ff99f600e9adecd1ffb262e764b9ab8e03d2

LukasKalbertodt avatar Oct 05 '24 10:10 LukasKalbertodt

Thank you @hanna-kruppe for already reviewing this before. Out of curiosity: what made you look into removing the dependency?

Every once in a while I like the exercise of reading through the lockfile. I was surprised to see num_cpus in one of my lockfiles, since it's a relic of the bad old days before std::thread::available_parallelism. After tracing that back to threadpool and looking at its lack of activity, open issues, and skimming the implementation, I thought there's gotta be a simpler way to run some tests in parallel.

hanna-kruppe avatar Oct 05 '24 11:10 hanna-kruppe

@hanna-kruppe Ah, that makes. I also do regularly do that (mostly via cargo tree). I'm simply not personally using libtest-mimic, so I tend to not notice this stuff.

And by the way (for the two of you): I just released v0.8.0 with these changes.

LukasKalbertodt avatar Oct 05 '24 11:10 LukasKalbertodt