On Tuesday 27 March 2001 14:43, Lothar Krause wrote:
> Hello,
>
> I know maybe this question was probably discussed in every possible way
> but... I have a problem with a piece of software that uses dynamic memory
> allocation everywhere. One side of the problem is that I'd like to use
> shared memory and so I thought of replacing malloc with an allocator that
> uses a given memory buffer.
> One the other side in realtime I'm restricted to use rtlinux without
> touching any internals,
Why? What do you mean, exactly?
(I mean, you can *always* touch the internals of a system that's completely
Free/Open Source. That's how people get it to solve their problems as
efficiently and/or easily as possible; the very idea of Free/Open Source. :-)
> so I guess I can't simply use rtai rt_mem_mgr,
Why not? You'd probably be better off hacking that if it doesn't fit your
problem, than writing a new one.
> my
> idea would be to preallocate a a memory block in init_module() and use my
> own allocator to manage that block afterwards.
Right; I'd guess most memory managers for use in applications (based on brk()
or similar APIs) should be possible to strip down to do something like that.
> Unfortunately I couldn't
> find a memory allocator that allows using your own memory block without
> stdio/stdlib nuisances.
Of course; 99% of developers are *not* kernel hackers, but stay in user
space...
So, just hack the stdio (etc) stuff out, replacing with RTL compatible calls
where needed.
> And I don't want to write still another memory
> allocator if someone else did this before.
Right; there are plenty of them. Grab one, and fix it if you have to.
(Yeah, I have one too, written in C++, meant to be used in an RTL project.
It's using multiple pools of fixed size blocks; one size per pool. Don't
remember if it could split blocks... Anyway, it's *not* thread safe by
design.)
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> [EMAIL PROTECTED] -'
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/