Hi David,

On Sun, Jul 25, 2021 at 11:07:00AM +0100, David CARLIER wrote:
> +/* OpenBSD does not have anything close to malloc_usable_size, thus 
> profiling will be wrong regardless */
> +#if defined(USE_MEMORY_PROFILING) && defined(__OpenBSD__)
> +#undef USE_MEMORY_PROFILING
> +#endif

I disagree with this one. It means that someone who forces
USE_MEMORY_PROFILING on this OS will get no error and will not know
that it was silently disabled. We precisely use build-time options to
make sure that the user has control over what is enabled or disabled.
This would be an exception in the middle of all other options, let's
not do it.

If OpenBSD doesn't have malloc_usable_size(), there are two
solutions. Either the option must not be used there (which is the
default), or we decide that we know for sure that it's stored at
*((char *)ptr - sizeof(void *)) with a mask, and we dereference it
there, and then we can enable it. But while I started this way at
the beginning, I'd rather avoid doing this because that could
break for those linking with different allocators.

Regards,
Willy

Reply via email to