I don't see much value in the LocalAlloc function, e.g. to get a small buffer for LoadString. Why not just define such buffers as uninitialized data?
Posted on 2001-05-28 16:49:00 by Larry Hammick
Larry, LocalAlloc is an obselete function, GlobalAlloc is still current in win32. Main advantage with memory allocation functions is that you can set the amount you require at runtime. OLE string memory, GlobalAlloc, VirtualAlloc, Ernie Murphy has written an iMalloc interface for memory allocation as well. Regards, hutch@pbq.com.au
Posted on 2001-05-29 02:42:00 by hutch--
Hey, There is no reason to use LocalAlloc, its probably better to use a .bss section because windows can only allocate memory in page granuality (4096 bytes). This of course leads to a big waste of memory as most strings are only 30 - 100 bytes long. It is a good idea to declare a general purpose buffer.
Posted on 2001-05-29 03:05:00 by George
imho its even better to use the stack for small buffers (no clue how small small is, but small is not large :)). the stack is your friend ;). some hll alike code: sub esp, size yourstruc mov ebp,esp mov eax, blabla add esp,size yourstruc and define somewhere your struc like struc yourstruc example dd ? ends
Posted on 2001-05-29 11:45:00 by lifewire
As I thought. sub esp,buffsize is natural but I will do an experiment on using absolute sites in ss for buffers -- often useful in DOS.
Posted on 2001-05-29 13:39:00 by Larry Hammick
What about heapAlloc?
Posted on 2001-06-02 08:55:00 by wolfao
HeapAlloc what you are supposed to use over local and global alloc in win95. But buffers that you use over and over again in your code, putting it in the data? is easier to do. For small temporary buffers, the stack is better. For large temporary buffers, heapAlloc is better. But these functions are more suited for making linked lists and other realated structers than buffers to store temporary strings.
Posted on 2001-06-04 16:49:00 by Satrukaan