flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
vid
You allocate when you don't know the needed size in advance.
|
|||
![]() |
|
dacid
After a search in the forum and in msdn, i found that HeapAlloc & VirtualAlloc are the best choices to allocate. Seems that HeapAlloc for small allocations and VirtualAlloc for bigger ones.
|
|||
![]() |
|
asmcoder
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:56; edited 1 time in total |
|||
![]() |
|
vid
Quote: sub esp,xxx - buffer but only if you are sure it won't be too big. Up to few kilobytes, taking more off the stack is not so good idea. |
|||
![]() |
|
f0dder
HeapAlloc for generic memory allocations, Local/GlobalAlloc for those few APIs that require it (clipboard related, CreateStreamOnHGlobal, etc.). VirtuaAlloc for huge allocations.
Stack is fine for several kilobytes, and preferable to heap because it's much faster to add/sub esp than managing heap structures. Just remember to pre-touch pages to trigger guard-page allocation mechanism ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.