Afficher un message
Vieux 17/10/2007, 13h21   #3
cr88192
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Regarding brk and sbrk


"venkat" <venkatavikas@gmail.com> wrote in message
news:1192616693.746964.168270@v23g2000prn.googlegr oups.com...
> Hi folks,
>
> Can some in understanding brk and sbrk. how does these are
> implemeted(means how the memeory will be allocated). How malloc will
> call these brk and sbrk. Please also give any example C program, where
> brk and sbrk are used to allocate memory.
>


as noted, these are not standard.
following this, they are not even a good idea...

now, for general info:
malloc implementations tend to grab chunks of memory from the OS, and brk
and sbrk were one such method (they worked by sliding a pointer, and
generally mapping in pages as needed and so on).

another, generally better, method, is the use of mmap (on linux and
friends).

on windows, a general way to grab raw memory is through VirtualAlloc.

however, all this is a generally non-portable issue, and so, the exact
answers will depend highly on the target OS...

or such...


> Appreciate your in this regard,
>
>
> Thanks,
> Vikas.
>



  Réponse avec citation
 
Page generated in 0,05001 seconds with 9 queries