From what i know, threads do share the heap memory, but can different processes share one heap also, does it happens by default?
If not, when one uses malloc ,and untill the heap memory runs out ,does the malloc operation is just returning the next memory block in the heap? because its clearly not allocated becase only one process has access to the heap, for example, lets say the heap memory holds 1-10 adresses, first malloc call (for 3 bytes) does not need to search any free memory it just allocates 1-3 adresses and returns adress 1, now second call also doesnt need to look for free space its just returning adress 4, and so on.. so until the memory run out malloc just returnes the adress of the next block of memory it doesn't need to look for free unallocated memory.
Is that trully what is happening?
Aucun commentaire:
Enregistrer un commentaire