lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Nick Trout wrote:
> Does anyone know of any useful tools that can determine how
> fragmented your memory is? I dont think you can say "my memory
> is x% fragmented" but you may be able to produce some stats
> giving useful information.

Check if your malloc system provides such info.  This works on many
platforms:

    #include <malloc.h>

    int GetFragmentationSize()
    {
        return mallinfo().arena - mallinfo().uordblks;
    }