Fwd: [Elua-svn] r71 - in trunk: . src src/platform/lpc288x

classic Classic list List threaded Threaded
1 message Options
BogdanM BogdanM
Reply | Threaded
Open this post in threaded view

Fwd: [Elua-svn] r71 - in trunk: . src src/platform/lpc288x


First, let's try to keep the conversation on the elua-dev list :) and
elua-svn dedicated to SVN traffic.
And now to answer your question: this has to do with the way
dlmalloc() requests memory. It doesn't know in advance how much RAM
you have free, it just requests small ammounts of memory (via sbrk)
until sbrk returns -1, or in other words "no more memory". It also has
an implementation of the mallinfo() function that is supposed to give
you memory statistics (which is what the "mem" command used). But,
because of the forementioned sbrk() behaviour, mallinfo() doesn't
actually know how much memory you have until the allocator requested
ALL the memory from the system (via successive calls to sbrk). Thus,
if you run this command when you first boot your board, you'll see
something like "total memory: 768     free memory:384", since the
allocator only requested a little ammount of memory from the system.
If you run the command later, you'll probably get a different report,
and so on. When you have requested all the memory from the system, the
report won't change anymore (well, the total memory part won't change
anymore), and this is when the report is actally right.
This is the story, and I find it very confusing and of little help.
Unfortunately this is how dlmalloc() works. If I do manage to
integrate aTLSF implementation at some point, we'll have some real
statistics. OR we can implement our own statistics by keeping counters
that we update when doing malloc/realloc/calloc/free, but
unfortunately this isn't accurate, as seggregated allocators (like
dlmalloc and TLSF) have some overhead that you can't compute (TLSF,
for example, keeps a two-level "page directory" and quite a bit of
overhead associated with it, about 3k of memory). The only way to know
about this overhead is via the mallinfo() function, but as you already
know, this doesn't help much.


---------- Forwarded message ----------
From: Fr?d?ric Thomas <elua-dev at thomascorner.com>
Date: Tue, Sep 2, 2008 at 2:51 AM
Subject: Re: [Elua-svn] r71 - in trunk: . src src/platform/lpc288x
To: elua-svn at lists.berlios.de

On Sep 1, 2008, at 15:21 , bogdanm at BerliOS wrote:

> Author: bogdanm
> Date: 2008-09-01 15:21:06 +0200 (Mon, 01 Sep 2008)
> New Revision: 71
> Log:
> modified the build system. Also removed the 'mem' command from the
> shell, as it was very confusing

We desperately need some easy way to monitor RAM on those memory
constrained board, so I think it should remain - or improved. What was
confusing about it ?


Elua-svn mailing list
Elua-svn at lists.berlios.de