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.
>
|