How big is the file?
Posted on 2001-03-02 05:56:00 by Mirno
The GlobalAlloc and LocalAlloc functions are limited to a combined total of 65,536 handles for GMEM_MOVEABLE and LMEM_MOVEABLE memory per process. This limitation does not apply to GMEM_FIXED or LMEM_FIXED memory.
As i understand it, the Heap can only provide up to ~64k of memory, under standard use. Iczelion's tutorial 12 used GlobalAlloc but allocates a max size of 65535 of memory (2^16 - 1). And backs this point up by only loading from file the same amount of bytes (if possible), regardless of the actually file size. If you want to load anything longer, I suggest you read Iczelion's tutorial 13 using Memory Mapped Files. NaN
Posted on 2001-03-03 00:05:00 by NaN
the file is 1040384 bytes, how would i use file mapping to load this in to the memory? This message was edited by moxy, on 3/3/2001 10:21:29 AM
Posted on 2001-03-03 09:51:00 by moxy
To NaN: GMEM_MOVEABLE (and as a result LMEM_MOVEABLE as they are the same), only supports 65,536 handles, a handle is not memory in and of itself, it is a kind of "pointer" to some memory. I believe this means that over 64k can be allocated in one block, but not more than 64k blocks can be allocated! The reason for using a handle is because the memory can be moved by the OS for some reason, and so when it is not "Locked" it could be in a different place to where you left it! Hence the handle provides some reference to that memory, that the OS is responsible for resolving (so it can be located again after it has been locked down)! I have never tried allocating more than 64k (chunks of memory) so I may be wrong, but the quote you gave did not state that! Mirno
Posted on 2001-03-05 06:21:00 by Mirno