flat assembler
Message board for the users of flat assembler.
Index
> Windows > .. |
Author |
|
pool 26 Aug 2009, 11:11
..
Last edited by pool on 17 Mar 2013, 11:58; edited 1 time in total |
|||
26 Aug 2009, 11:11 |
|
shoorick 26 Aug 2009, 11:54
sub esp,4
|
|||
26 Aug 2009, 11:54 |
|
pool 26 Aug 2009, 12:10
..
Last edited by pool on 17 Mar 2013, 11:58; edited 1 time in total |
|||
26 Aug 2009, 12:10 |
|
revolution 26 Aug 2009, 12:18
What is you deallocation strategy/pattern? FIFO, LIFO, random? Is the program going to run for extended periods? If so then memory fragmentation can create some problems with the wrong allocation type. You need to specify more about the alloc/dealloc profile.
|
|||
26 Aug 2009, 12:18 |
|
madmatt 26 Aug 2009, 12:23
For me, the better one is, Windows VirtualAlloc, it is always aligned on at least a 16 byte boundary suitable for SSE data. The c function malloc is at best, aligned only to a 4 byte boudary. which is faster? I don't know.
|
|||
26 Aug 2009, 12:23 |
|
f0dder 26 Aug 2009, 15:16
There's not much point in Local/GlobalAlloc, since they end up calling HeapAlloc internally (they do pass a magic flag value though, so when MSDN says you must use one of them (like with clipboard functions), better do so).
VirtualAlloc isn't suitable for small allocations - it has rather large overhead (always takes a kernel mode roundtrip) and has 64kb allocation granularity (on x86 anyway - if you wan to precise granularity, consult GetSystemInfo().dwAllocationGranularity). Stack de/allocation is pretty darn fast, but isn't so suitable for long-lived data - and for shrinking/growing allocations or non-FIFO dealloc it's somewhat problematic. You're also limited in how much you can allocate from the PE stack reserve settings, and for "large" allocations you need to do stack probing (unless you only touch the memory backwards ). HeapAlloc is a pretty decent default, and the low-fragmentation heap introduced with XP is OK (iirc they made it the default heap type in Vista - or perhaps it was Win7). There's been a lot of optimizations to the Heap* functions during the Windows versions, for speed as well as security. For "extreme" situations you can roll your own allocator, or find an existing nice allocator like phkmalloc. |
|||
26 Aug 2009, 15:16 |
|
revolution 26 Aug 2009, 15:43
f0dder wrote: Stack de/allocation is pretty darn fast, but isn't so suitable for long-lived data - and for shrinking/growing allocations or non-FIFO dealloc it's somewhat problematic. |
|||
26 Aug 2009, 15:43 |
|
f0dder 26 Aug 2009, 22:58
revolution wrote:
_________________ - carpe noctem |
|||
26 Aug 2009, 22:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.