rpmalloc icon indicating copy to clipboard operation
rpmalloc copied to clipboard

rpmalloc and msvc asan

Open plekakis opened this issue 2 years ago • 4 comments

I am not currently sure if it's a false-positive or a valid issue, but MSVC 2022 address sanitizer complains when rpmalloc is used as the allocation method. I suspect it's a false positive as I have no runtime errors when allocating and freeing a lot of data over several frames (it's a game engine's stress test).

Is this worth investigating (and has rpmalloc been tested with asan)?

plekakis avatar Dec 17 '23 22:12 plekakis

I have not tested it with asan - do you have any details you can share of what it's complaining about?

Would be very interested in looking into this, both in the develop branch and also (if you have time) in the mjansson/rewrite branch

mjansson avatar Dec 22 '23 22:12 mjansson

I will collect some info, but I am on holiday now and may take a while.

Sent from Outlook for iOShttps://aka.ms/o0ukef


From: Mattias Jansson @.> Sent: Saturday, December 23, 2023 12:29:27 AM To: mjansson/rpmalloc @.> Cc: Pantelis Lekakis @.>; Author @.> Subject: Re: [mjansson/rpmalloc] rpmalloc and msvc asan (Issue #319)

I have not tested it with asan - do you have any details you can share of what it's complaining about?

Would be very interested in looking into this, both in the develop branch and also (if you have time) in the mjansson/rewrite branch

— Reply to this email directly, view it on GitHubhttps://github.com/mjansson/rpmalloc/issues/319#issuecomment-1868107682, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABL7J5PMPYUIZDMYDY3HW6DYKYCUPAVCNFSM6AAAAABAYVP2FKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRYGEYDONRYGI. You are receiving this because you authored the thread.Message ID: @.***>

plekakis avatar Dec 22 '23 23:12 plekakis

Here is how rpmalloc can be used with ASAN under and MSVC.

https://learn.microsoft.com/en-us/cpp/sanitizers/asan-runtime?view=msvc-170#custom-allocators-and-the-addresssanitizer-runtime

I did choose another way. I made wrapper function around the rpmalloc functions and control with a define if rpmalloc or if the default memory functions should be used. When ASAN is active then default CRT memory functions like malloc are used. This will catch if I did something stupid. The only downside is, it will not catch errors caused by rpmalloc.

SunnyPaprika avatar Jan 05 '24 13:01 SunnyPaprika

Ok started doing the same to be honest. I use ASAN currently always in my debug builds and when that happens I revert back to the crt

Sent from Outlook for iOShttps://aka.ms/o0ukef


From: Alex @.> Sent: Friday, January 5, 2024 3:13:13 PM To: mjansson/rpmalloc @.> Cc: Pantelis Lekakis @.>; Author @.> Subject: Re: [mjansson/rpmalloc] rpmalloc and msvc asan (Issue #319)

Here is how rpmalloc can be used with ASAN under and MSVC.

https://learn.microsoft.com/en-us/cpp/sanitizers/asan-runtime?view=msvc-170#custom-allocators-and-the-addresssanitizer-runtime

I did choose another way. I made wrapper function around the rpmalloc functions and control with a define if rpmalloc or if the default memory functions should be used. When ASAN is active then default CRT memory functions like malloc are used. This will catch if I did something stupid. The only downside is, it will not catch errors caused by rpmalloc.

— Reply to this email directly, view it on GitHubhttps://github.com/mjansson/rpmalloc/issues/319#issuecomment-1878641804, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABL7J5N3VMAWCDLY3V6TLE3YM736TAVCNFSM6AAAAABAYVP2FKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZYGY2DCOBQGQ. You are receiving this because you authored the thread.Message ID: @.***>

plekakis avatar Jan 05 '24 13:01 plekakis