* [ECOS] malloc
@ 2001-02-01 13:11 Lewin A.R.W. Edwards
2001-02-02 19:55 ` Jonathan Larmour
0 siblings, 1 reply; 3+ messages in thread
From: Lewin A.R.W. Edwards @ 2001-02-01 13:11 UTC (permalink / raw)
To: ecos-discuss
Quick question: Does anyone here (using 1.3.1) have problems using malloc?
I'm using the Cirrus 7212 and malloc seems to be very random in behavior -
sometimes it will succeed on a few allocations and then fail on one more.
Then, it will succeed on some (larger!) allocations in the same session.
I'm asking this because I want to know if I have some deeper underlying
problem; broken heap management is not a killer for me because I prefer to
avoid dynamic allocation in embedded apps.
=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/
"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ECOS] malloc
2001-02-01 13:11 [ECOS] malloc Lewin A.R.W. Edwards
@ 2001-02-02 19:55 ` Jonathan Larmour
2001-02-03 7:13 ` Lewin A.R.W. Edwards
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Larmour @ 2001-02-02 19:55 UTC (permalink / raw)
To: Lewin A.R.W. Edwards; +Cc: ecos-discuss
"Lewin A.R.W. Edwards" wrote:
>
> Quick question: Does anyone here (using 1.3.1) have problems using malloc?
>
> I'm using the Cirrus 7212 and malloc seems to be very random in behavior -
> sometimes it will succeed on a few allocations and then fail on one more.
> Then, it will succeed on some (larger!) allocations in the same session.
I found some problems in the memory allocator a while back and fixed them.
Alas I also redesigned the memory allocation system at the same time, so it
wouldn't be easy to backport the patches, although you could maybe try -
the new version is in anonymous CVS under services/memalloc/common
Jifl
--
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ECOS] malloc
2001-02-02 19:55 ` Jonathan Larmour
@ 2001-02-03 7:13 ` Lewin A.R.W. Edwards
0 siblings, 0 replies; 3+ messages in thread
From: Lewin A.R.W. Edwards @ 2001-02-03 7:13 UTC (permalink / raw)
To: ecos-discuss
Hi Jonathan,
> > I'm using the Cirrus 7212 and malloc seems to be very random in behavior -
>
>I found some problems in the memory allocator a while back and fixed them.
>Alas I also redesigned the memory allocation system at the same time, so it
I'm happy to hear that there _is_ a known problem with the version I've
got, because it indicates that I probably don't have some deeper lurking
problem :)
I have written my own "dirty memory manager" which sounds rather like how
you described the old eCos manager, except that my implementation does not
support realloc or free. It has a fixed heap size (static array).
When I am using dynamic allocation, I don't want the structures to have any
permanent lifespan. There are only two parts of my code that use dynamic
allocation, because they need to create an indeterminate (known only at
runtime) number of structures of an indeterminate size. I know roughly what
the aggregate size of these structures will be, but not how the space will
be distributed. The structures exist while I am decoding a particular data
stream, and have no meaning thereafter, so my memory manager essentially
only works with one process - you call a "reset" function before you use
it, and then allocate all you want. When you're finished, there is no need
to deallocate anything because the next time the reset function is called,
all sins are forgiven.
It is much, much, much easier for me to do this than to have to worry about
heap fragmentation.
=== Lewin A.R.W. Edwards (Embedded Engineer)
Work: http://www.digi-frame.com/
Personal: http://www.zws.com/ and http://www.larwe.com/
"Und setzet ihr nicht das Leben ein,
Nie wird euch das Leben gewonnen sein."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-02-03 7:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-01 13:11 [ECOS] malloc Lewin A.R.W. Edwards
2001-02-02 19:55 ` Jonathan Larmour
2001-02-03 7:13 ` Lewin A.R.W. Edwards
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).