comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Mize <smize@link.com>
Subject: Re: dynamic memory allocation
Date: 1997/06/16
Date: 1997-06-16T00:00:00+00:00	[thread overview]
Message-ID: <33A5B512.5FD4B913@link.com> (raw)
In-Reply-To: 33A55F1B.63FE@gsfc.nasa.gov


Stephen Leake wrote:
>I
> have suggested that the heap could become fragmented (the buffers are
> NOT all the same size). They say "we'll just test it thoroughly".

This is pathetic.

On the other hand, you say the messages are not all the same size.
If they of specific-size message types, AND you can derive a
maximum number that will need to exist at any time, each message
type can have its own storage pool.  The result is that there is
not one heap being fragmented, each message type has its own chunk
of memory to allocate from.  If you can define a maximum number for
each type, you can ensure you will always have enough memory.

If the buffers are of variable size, fragmentation certainly
might occur.

If you can't define a maximum number of messages to be handled at
a given moment, you can't define how much memory you will need to
begin with (you can determine "likely to be OK" but not "proven
to be OK no matter what").

> Can anyone provide a reference to a book or study article that
> says this is bad? To me it seems obvious, and the general tone
> in this newsgroup is that it's obvious. I have a couple books on
> realtime embedded design, and they don't even bother to mention
> dynamic allocation - unfortunately, that makes it hard to say
> "see, this book says it's bad".
>
> On the other side, are there any discussions of how to test such a
> system, to show that it does not become fragmented? Or a book on
> designing dynamic memory allocation algorithms to avoid fragmentation?

Real-time embedded system developers tend to avoid dynamic memory,
so it's not surprising that your references don't mention it.

I don't have a reference, but I suggest you look at books outside
the embedded real-time domain.  Real-time embedded system
developers have tended to avoid dynamic memory, so you won't find
much in that literature.

Best of luck with it,
Sam Mize

--
-- Samuel Mize    (817) 619-8622    smize@link.com    "Team Ada"
-- Hughes Training Inc.  PO Box 6171 m/s 400, Arlington TX 76005




  reply	other threads:[~1997-06-16  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-16  0:00 dynamic memory allocation Stephen Leake
1997-06-16  0:00 ` Samuel Mize [this message]
1997-06-16  0:00 ` Joel Seidman
1997-06-17  0:00 ` Robert Dewar
1997-06-17  0:00   ` Spam Hater
1997-06-17  0:00     ` Robert Dewar
1997-06-17  0:00   ` Stephen Leake
1997-06-17  0:00     ` Brian Rogoff
1997-06-17  0:00     ` Michael F Brenner
1997-06-17  0:00 ` Jon S Anthony
1997-06-18  0:00   ` Mats.Weber
1997-06-18  0:00     ` Jon S Anthony
1997-06-17  0:00 ` Glen Cornell
1997-06-18  0:00 ` David Wheeler
1997-06-18  0:00 ` David Wheeler
1997-06-18  0:00   ` Stephen Leake
1997-06-19  0:00     ` Arthur Schwarz
1997-06-20  0:00     ` David Wheeler
1997-06-19  0:00   ` JP Thornley
  -- strict thread matches above, loose matches on Subject: below --
1997-06-19  0:00 Marin David Condic, 561.796.8997, M/S 731-93
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox