I dont think u can tell wheather it will increase or decrease.

When u call a malloc it calls sbrk() system call which would get a chunk of memory from the freee memory and would map the virtual address to that memory page.

When you call a free it would deallocate the memory back meaning it will unmap the virtual memory memory page mapping.

Here is my doubt against your statement

your program:

allocate first bytes of memory (first call of malloc call it m1 )  - return address = 0x001

you did more allocations and now the virtual address returned by the last malloc = 0x010

you did a free m1

Now it is highly possible that the some of the malloc coming after the free will use the earlier virtul memory address for its allocation


Please let me knwo about your inputs ..

Thanks,
Manu


On 3/7/06, Manu <[EMAIL PROTECTED]> wrote:

Hello,

Can we say that the return addresses from the various malloc function
calls, in a program, will always be in a predefined order (increasing
or decreasing,  depeding on how the heap is managed) ?



--
Manu Jose,
mob :09844467453
E-mail : [EMAIL PROTECTED]
-------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to