On Wednesday, February 9, 2011 10:04:56 AM UTC-6, hopcode wrote:
> Hi All,
> What do you think about using stack
> for memory allocation in 64bit programs ?
I've never used it in Windows, but there are existing functions for this purpose, such as alloca(), which would be examined:
http://msdn.microsoft.com/en-us/library/ew5tede7.aspx
Stack memory is desirable for malloc()-like functions in some instances, including these (among others):
1) The memory is more likely to be in the L1 or L2 cache already, or more often
2) It has the advantage of allocating memory only in/for the function needed
3) Allows for easy re-entrant code that has high or arbitrary memory needs
4) By walking backward through stack frames, it is possible to access other function's data, and even manipulate it if necessary, through a known convention by design.
- Rick C. Hodgin
|
|
0
|
|
|
|
Reply
|
Rick
|
2/10/2011 3:10:30 AM |
|