Re: Kernel malloc/realloc?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Doron Holan [MS] (doronh_at_nospam.microsoft.com)
Date: 02/05/04


Date: Wed, 4 Feb 2004 20:38:15 -0800

one of the semantics of realloc is that the same pointer as before can be
returned (i haven't used realloc in such a long time, i can't remember if
this true 100% of the time or not). Based on this assumption if you were to
resize a buffer, you would need to
1) make sure any threads that are using the previous buffer have stopped
using it
2) update the field which contains the pointer value so that no one picks
up the old value and starts using the new one

d

-- 
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only.
"Bogdan Bejan" <na@na.na> wrote in message
news:ufvFlI36DHA.2952@TK2MSFTNGP09.phx.gbl...
> I wasn't sure is shuch API exists in kernel, thanx for clearing it.
>
> "Doron Holan [MS]" <doronh@nospam.microsoft.com> wrote in message
> news:uocOjcs6DHA.1556@tk2msftngp13.phx.gbl...
> > no such API exists.  you must be able to update the pointer value
> atomically
> > if you need to have a bigger allocation
>
> Don't you have to update the pointer with realloc to? Isn't realloc based
on
> GlobalRealloc?Which i suppose works by allocating more hardware pages and
> mapping them in a new vitual location, where you have enough virtual space
> for the new buffer?
>
> >
> > d
> >
> > -- 
> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > Please reply to newsgroups only.
> >
> > "Bogdan Bejan" <na@na.na> wrote in message
> > news:euNZM9r6DHA.2764@TK2MSFTNGP09.phx.gbl...
> > > How can you alocate then realocate a memory buffer in kernel mode
(W2k+)
> ?
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: realloc() implicit free() ?
    ... >> another] what happens to the input block when realloc() finds it ... > you must instead use the output pointer value. ... The realloc function changes the size of the object pointed to by ... new, deallocate the old, and return a pointer to the new -- but I see ...
    (comp.lang.c)
  • Re: filters
    ... you go about writing a filter, ... just be put into some buffer. ... * if realloc() fails, it returns a null pointer, and pointers into the ...
    (comp.lang.c)
  • Re: filters
    ... stdin and processes it? ... just be put into some buffer. ... * if realloc() fails, it returns a null pointer, and pointers into the ...
    (comp.lang.c)
  • Re: Dynamic buffer library
    ... We do it this way instead of using a struct so that ... /* We now need to get the address of the buffer, because realloc() ... The address of the _pointer_. ... from and to all data pointer types, but void** canNOT validly point to ...
    (comp.lang.c)
  • Re: Kernel malloc/realloc?
    ... > one of the semantics of realloc is that the same pointer as before can be ... Any for of realocation of a memory buffer can't possible guarantee to return ... I just don't know how to acctualy resize a memory buffer in kernel mode. ...
    (microsoft.public.development.device.drivers)