Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[VxW] Memory Measurement

880 views
Skip to first unread message

Srinivas O

unread,
Mar 1, 2004, 2:18:08 AM3/1/04
to vxwe...@csg.lbl.gov
Hi all,
In the VxWorks, if we use memShow() function, the result is displayed in
the following format.

-> memShow 1

FREE LIST:
num addr size
--- ---------- ----------
1 0x3fee18 16
2 0x3b1434 20
3 0x4d188 2909400

SUMMARY:
status bytes blocks avg block max block
------ --------- -------- ---------- ----------
current
free 2909436 3 969812 2909400
alloc 969060 16102 60 -
cumulative
alloc 1143340 16365 69 -

I have some doubts on this information,

a. What is meant by Cumulative Alloc?
b. Even after the memory is freed, still we see increment in cumulative
alloc?
What does it refer?


Thanks and Regards
O.Srinivasan

Andrew Johnson

unread,
Mar 1, 2004, 2:27:27 PM3/1/04
to VxWorks Users Group List
Srinivas O wrote:
> status bytes blocks avg block max block
> ------ --------- -------- ---------- ----------
> current
> free 2909436 3 969812 2909400
> alloc 969060 16102 60 -
> cumulative
> alloc 1143340 16365 69 -
>
> I have some doubts on this information,
>
> a. What is meant by Cumulative Alloc?
> b. Even after the memory is freed, still we see increment in cumulative
> alloc?
> What does it refer?

It is total number of bytes that have been allocated using malloc() since
vxWorks started. Every time you call malloc() it adds the allocation size
to both the cumulative and the current alloc counters. When you call
free() the block size gets subtracted from the current alloc counter, but
*not* from the cumulative alloc one.

It's useful to know this in an embedded system because some systems are
designed to only allocate memory at initialization. If the cumulative
figure keeps climbing after initialization on such a system, you know that
someone is breaking the rules and doing malloc()/free() calls after they
should have stopped.

- Andrew
--
Dear God, I didn't think orange went with purple until I saw
the sunset you made last night. That was really cool. - Caro

James Clough

unread,
Mar 1, 2004, 9:52:11 PM3/1/04
to
Srinivas,


"Andrew Johnson" <a...@aps.anl.gov> wrote in message
news:mailman.16.107816...@csg.lbl.gov...


> Srinivas O wrote:
> > status bytes blocks avg block max block
> > ------ --------- -------- ---------- ----------
> > current
> > free 2909436 3 969812 2909400
> > alloc 969060 16102 60 -
> > cumulative
> > alloc 1143340 16365 69 -
> >
> > I have some doubts on this information,
> >
> > a. What is meant by Cumulative Alloc?
> > b. Even after the memory is freed, still we see increment in cumulative
> > alloc?
> > What does it refer?
>
> It is total number of bytes that have been allocated using malloc() since
> vxWorks started. Every time you call malloc() it adds the allocation size
> to both the cumulative and the current alloc counters. When you call
> free() the block size gets subtracted from the current alloc counter, but
> *not* from the cumulative alloc one.
>
> It's useful to know this in an embedded system because some systems are
> designed to only allocate memory at initialization. If the cumulative
> figure keeps climbing after initialization on such a system, you know that
> someone is breaking the rules and doing malloc()/free() calls after they
> should have stopped.
>

Also, keep in mind that if you are entering commands on the target shell
there is an underlying parser that will make malloc calls so the accumulated
value will also increment when you run target commands. HTH...

0 new messages