Yep, thanks, I've got the idea that only the OS itself can only access this part of the memory.
Yep, thanks, I've got the idea that only the OS itself can only access this part of the memory.
Not sure you completely understand how things work. There are many different ways that we COULD implement a memory pool manager (which malloc/free traditionally provides some of the functions to use). The concept is rather simple: We get a big block of memory, and split it into smaller portions, marking those portions as "in use", and when freeing, you record the freed memory as "not in use".
How you get that memory depends on the OS implementation. Generally, the OS manages some sort of basic "big block" methods that work on the same principle as malloc & free, but are more suitable when allocating kilobytes or megabytes, rather than a few dozen bytes.
The application itself can not get more memory without asking the OS to get it. This is where the "big block memory allocation" comes in handy. In windows, that would normally be the HeapAlloc() function, but there are several others [but those have specific functionality/restrictions that isn't ideal if you want to implement malloc()].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.