libssh2 icon indicating copy to clipboard operation
libssh2 copied to clipboard

Incompatibilty with memory leak detectors

Open marcstern opened this issue 5 years ago • 8 comments

Most memory leak detectors redefine "alloc", "realloc" and "free" (and others). In struct _LIBSSH2_SESSION, we have fields with these names. This breaks the syntax when using such a memory leak detector. Could you rename these fields (like "alloc_func")? Thanks

marcstern avatar Jun 23 '20 07:06 marcstern

Leakage detector should have the ability to detect leakage without source code change, if the detector is too weak and relay on source code change, how can they detect leakage inside a pre-compiled library?

Thanks!

tsengjun avatar Jul 25 '20 07:07 tsengjun

I agree with @tsengjun. We've tracked memory leaks for a long time already so I don't see why we need to change code. valgrind and memory sanitizers work fine already.

bagder avatar Jul 25 '20 14:07 bagder

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 26 '20 22:11 stale[bot]

I understand that I didn't explain the whole issue. When working with Visual Studio on a solution with several dozens projects, if you need to track a memeory leak, you need to include your debugging code in all libs in order to understand where an not deallocated block comes from. That can be done in 30 seconds. If you need to do it for every single project but libssh2, it's very long and cannot be undone easily. So I understand you do not need this, but it would help your users in some situations and it's such a trivial change without any drawback ... that I hope you will accept it. Thanks a lot for your time

marcstern avatar Nov 27 '20 07:11 marcstern

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 02 '21 17:06 stale[bot]

Any chance to make this trivial change? Thanks a lot

marcstern avatar Jun 03 '21 06:06 marcstern

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 19:04 stale[bot]

Could anyone look at this? Thanks a lot

marcstern avatar Apr 19 '22 06:04 marcstern

@marcstern I still don't fully understand why your leak detector needs to re-write alloc/free, etc. Feel free to submit a PR with your changes, but we're not likely to make these changes since it works as-is with most leak detectors.

willco007 avatar Feb 25 '23 03:02 willco007

As @willco007 said, if this is resolved by renaming a few internal symbols, I think we're ready to accept a PR for this.

vszakats avatar May 05 '23 21:05 vszakats