malloc_size - Unix

This is a discussion on malloc_size - Unix ; I realize that the C standard does not specify any sort of function call that gives you low-level information about the size of allocated memory blocks, but some implementations provide extensions such as _msize on Windows and malloc_size on Mac ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: malloc_size

  1. malloc_size

    I realize that the C standard does not specify any sort of function
    call that gives you low-level information about the size of allocated
    memory blocks, but some implementations provide extensions such as
    _msize on Windows and malloc_size on Mac OS X.

    Other than Mac OS X, are there any UNIX based C implementations that
    provide this? malloc_size, at least, doesn't seem to be included in
    Linux 2.6 or Solaris 10.


  2. Re: malloc_size

    chsalvia@gmail.com wrote:

    > I realize that the C standard does not specify any sort of function
    > call that gives you low-level information about the size of allocated
    > memory blocks, but some implementations provide extensions such as
    > _msize on Windows and malloc_size on Mac OS X.
    >
    > Other than Mac OS X, are there any UNIX based C implementations that
    > provide this? malloc_size, at least, doesn't seem to be included in
    > Linux 2.6 or Solaris 10.
    >

    Some have "mallinfo()" which may return the information you want.

    Cheers,
    Gary B-)

    --
    __________________________________________________ ____________________________
    Armful of chairs: Something some people would not know
    whether you were up them with or not
    - Barry Humphries

  3. Re: malloc_size

    On 13 Aug, 01:13, chsal...@gmail.com wrote:
    > I realize that the C standard does not specify any sort of function
    > call that gives you low-level information about the size of allocated
    > memory blocks, but some implementations provide extensions such as
    > _msize on Windows and malloc_size on Mac OS X.
    >
    > Other than Mac OS X, are there any UNIX based C implementations that
    > provide this? malloc_size, at least, doesn't seem to be included in
    > Linux 2.6 or Solaris 10.


    Why do you need such a facity? Can you not store the size somewhere
    when the memory has just been allocated? man __malloc_hook might be of
    interest.


+ Reply to Thread