How do DOS memory allocation routines can be something comparative with malloc and free?
malloc and free are C RTL functions, different in every EXE !
Same now ! only a few programs use Windows or Linux heap management, instead they get memory range from OS and then split it to smaller pieces internally.
- This probably refers to DOS INT 21h functions 48 (allocate memory) and 49 (free allocated memory), or their protected-mode equivalents in a DOS extender. I don't know if most DOS compilers would use these calls directly, or manage the memory more like other mallocs, by allocating large chunks at a time and doleing out smaller pieces as they're requested. CODOR 20:46, 17 June 2006 (UTC)
I can't speak for all compilers, but usually, under DOS at least, malloc calls the lower-level function sbrk, which in turn calls operating system-level functions via interrupts, like CODOR describes above. Protected multitasking operating systems with paging and segmentation naturally make memory more complicated and shield programs for those systems from dealing with it directly.--Quasar 00:45, 18 September 2006 (UTC)