[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: [rtl] Follow-Up to Constructors/Destructors
Ken Teh wrote:
> On Fri, 1 May 1998, Daniele Lugli wrote:
>
> >
> > No. I have several objects, even if none has a destructor.
> > (By the way, I tried to add an empty destructor and I got "free undefined").
> >
>
> Isn't this the problem of linking statically with libc? Kernel drivers
> don't have the luxury of access to the runtime libraries. Seems to me that
> if "free" is undefined, then it's not linked into the object.
>
> Just guessing.
>
Maybe. But there should be no need for "free" as there is no "malloc" nor "new".
Why should a destructor need "free" for a global object, no part of which is
allocated on the heap? Maybe for some internal compiler tables??
I know of several other situations where _builtin_new _builtin_delete or similar
suspicious functions are smuggled in even if there should be no need for them,
but such situations are easily avoidable (eg inlined constructors, virtual void
functions). I never tried destructors before and I am surprised that they need
"free".
I don't know what this "free" is, but if it does memory deallocation it could
cause problems. Memory allocation/deallocation routines are not reentrant. I
think that neither kmalloc/kfree should be used in an rt task, as the rt task can
preempt the kernel.
Daniele
--- [rtl] ---
For more information on Real-Time Linux see:
http://rtlinux.cs.nmt.edu/