This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to see the Heap usage in eCos ? Malloc is failing.


On Tue, Oct 05, 2004 at 12:25:39PM +0900, Mohasin Zaki wrote:
> Dear All,
> 
> Is there anyway (any eCos library) by which I can see the current heap usage
> ?
> 
> malloc() is failing, returning NULL. So I would like to debug the situation,
> to see if there are any leaks in my code.
> 
> In Vxworks, we used to use a library called memLib in which memShow() would
> would show the total system heap, the current usage, the peak usage, etc.
> Something like this would really help in debugging the situation.

stdlib.h:

/* SVID2/XPG mallinfo structure */
 
struct mallinfo {
    int arena;    /* total size of memory arena */
    int ordblks;  /* number of ordinary memory blocks */
    int smblks;   /* number of small memory blocks */
    int hblks;    /* number of mmapped regions */
    int hblkhd;   /* total space in mmapped regions */
    int usmblks;  /* space used by small memory blocks */
    int fsmblks;  /* space available for small memory blocks */
    int uordblks; /* space used by ordinary memory blocks */
    int fordblks; /* space free for ordinary blocks */
    int keepcost; /* top-most, releasable (via malloc_trim) space */
    int maxfree;  /* (NON-STANDARD EXTENSION) size of largest free block */
};
 
extern struct mallinfo
mallinfo( void );
 
        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]