madvise() works at the page level and if you're using madvise(), then you're expected to be using mmap() to allocate pages explicitly. It would be unusual and a bad idea to start madvise()ing memory that's being handled by an allocator (like malloc).
Of course you could also write a security focused heap allocator that uses these madvise() options under the hood.
Of course you could also write a security focused heap allocator that uses these madvise() options under the hood.