Re: [linux-audio-dev] malloc() in RT code considered not-so-harmful?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] malloc() in RT code considered not-so-harmful?
From: Tim Hockin (thockin_AT_hockin.org)
Date: Wed Jul 14 2004 - 08:18:12 EEST


On Wed, Jul 14, 2004 at 05:58:25AM +0200, Ralf Beck wrote:
> Am Dienstag, 13. Juli 2004 22:50 schrieb Steve Harris:
> > On Tue, Jul 13, 2004 at 10:21:23 -0700, Joshua Haberman wrote:
> > > >Its not my experieince that you usually need to allocate memory in RT
> > > >threads, the times when I've seen it done are mostly <generalisation>
> > > >bacuase of bad design, excessive OO-ness or lack of knowledge of
> > > >alloca(3) </generalisation>.
> > >
>
> malloc does not guarantee, that the allocated memory is locked into physical
> memory.
> To say it short: A RT thread must NEVER call a function that might block!!

The point was that an RT-safe malloc() could be safe, but it indicates a
bad design.

If your app starts up, does malloc(1024*1024*32); walks through that
memory to page it in, then mlock()s it, you can write a "safe" malloc to
allocate from that memory. But yuck.

Tim


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Wed Jul 14 2004 - 08:20:53 EEST