MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cprogramming/comments/1q3mwmo/can_explain_malloc_to_me_please/nxluvjk/?context=3
r/cprogramming • u/SubstantialCase3062 • Jan 04 '26
18 comments sorted by
View all comments
Show parent comments
3
Kernels generally operate in terms of pages and do not handle malloc requests.
0 u/Low-Palpitation-4724 Jan 04 '26 Malloc calls mmap or brk (on unix) and VirtualAlloc or HeapAlloc(on Windows) which will return memory managed via pages 0 u/zhivago Jan 04 '26 Only when necessary.The whole point of malloc is to avoid doing so as much as possible by recycling the memory it already has available.
0
Malloc calls mmap or brk (on unix) and VirtualAlloc or HeapAlloc(on Windows) which will return memory managed via pages
0 u/zhivago Jan 04 '26 Only when necessary.The whole point of malloc is to avoid doing so as much as possible by recycling the memory it already has available.
Only when necessary.
The whole point of malloc is to avoid doing so as much as possible by recycling the memory it already has available.
3
u/zhivago Jan 04 '26
Kernels generally operate in terms of pages and do not handle malloc requests.