Malloc, return address order.

M

Manu

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) ?

regards
Manu
 
K

Keith Thompson

Manu said:
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) ?

No.
 
R

Richard Tobin

Manu said:
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) ?

No. Even supposing your implementation happened to allocate memory
sequentially (which is not required, and many implementations don't),
what do you think would happen after you freed some memory? The point
of freeing it is so that it can be used again.

-- Richard
 
?

=?ISO-8859-1?Q?=22Nils_O=2E_Sel=E5sdal=22?=

Manu said:
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) ?

Not at all.
 
R

Rod Pemberton

Keith Thompson said:

What no OT complaint about 'heap'?

Specifically, memory paging and memory or heap reuse almost guarantees that
the answer is "No."


Rod Pemberton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top