This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: How to see the Heap usage in eCos ? Malloc is failing.
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Mohasin Zaki <mohasin at rpg dot rd dot allied-telesis dot co dot jp>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Tue, 5 Oct 2004 09:06:38 +0200
- Subject: Re: [ECOS] How to see the Heap usage in eCos ? Malloc is failing.
- References: <HMENJNKNHPNFGKPJAELIKENGCBAA.mohasin@rpg.rd.allied-telesis.co.jp>
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