Manually-allocated memory and maximum array capacity

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Mon Apr 7 13:58:21 PDT 2014


On 05/04/14 02:18, Artur Skawina wrote:
> Not portably, as it will be libc and/or allocator specific.

I think that's fine.  I would be using it in circumstances where it's nice to 
have if I can get it, not a problem if I can't.  As long as I make appropriate 
use of version statements to ensure it's only used where available, it should be 
OK and not affect usability.

> For example, for glibc this would work:
>
>     /* static if (using_glibc) */
>     size_t capacity(const void* p) @property @safe {
>        return malloc_usable_size(p);
>     }

Thanks! :-)



More information about the Digitalmars-d-learn mailing list