No, unfortunately not -- the reason is that for large memory
allocations new really calls malloc which goes to mmap -- and thus mmap is
used to allocate additional memory. This system call appears to choke when
called from kernel space. I have tried it ! :-)..
However, the way around it is to put your own wrapped malloc
routine -- you do this using "ld --wrap malloc". So, you define
__wrap_malloc which causes all versions of malloc to turned into
__wrap_malloc and presto all versions of new now will call your allocator
routine. That allocator routine just calls vmalloc -- however I would
advise you just block allocate a bunch of memory and manage it your self
and not make many calls to vmalloc. You so this similarly with delete by
wrapping free, I believe. I have not tried to wrap free specifically
however,
Hope this helps,
Chris
--------------------------------------------------------------------
Christopher D. Carothers
Assistant Professor
Department of Computer Science
Rensselaer Polytechnic Institute
110 8th Street
Troy, New York 12180-3590
e-mail: [EMAIL PROTECTED]
web page: www.cs.rpi.edu/~chrisc
phone: (518) 276-2930
fax: (518) 276-4033
--------------------------------------------------------------------
On Mon, 18 Mar 2002, Steven Seeger wrote:
> Karl,
>
> Are new and delete even safe to use in kernel space? Come to think of it, I
> never actually tried.
>
> Steve
>
> >-----Original Message-----
> >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> >[EMAIL PROTECTED]
> >Sent: Sunday, March 17, 2002 3:59 AM
> >To: [EMAIL PROTECTED]
> >Subject: Re: [rtl] (RT) C++ why you should use it
> >
> >
> >C++ has its places, especially where inheritance fits well,
> >and GUI is the
> >best example for the use of inheritance.
> >For more procedure stuff like the kernel or device driving then C works
> >well.
> >Remember there are more mundane features of OO like grouping
> >procedures and
> >data into packages which can be done with any language though
> >C++ provides
> >one with features to do it and control it.
> >
> >One danger I see with using C++ is that using RTLinux implies one wants
> >control over what happens especially with predictable timing. What a
> >compiler does with C++, especially dynamic calling, creation
> >and deletion
> >of objects and memory allocation and worse of all memory
> >deallocation may
> >mean one loses control.
> >
> >Karl.
> >
>
> -- [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/
>
>
-- [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/