Path: utzoo!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!hsdndev!spdcc!dirtydog!ima.isc.com!martinr From: martinr@ima.isc.com (Martin Romano) Newsgroups: comp.windows.ms.programmer Subject: Big allocations bite the big one? Message-ID: <1991Mar18.184114.29112@ima.isc.com> Date: 18 Mar 91 18:41:14 GMT Sender: usenet@ima.isc.com Reply-To: martinr@ima.isc.com (Martin Romano) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 27 Originator: martinr@starfish.ima.isc.com Is there a limit on the size of a memory block allocated by GlobalAlloc() *other* than: 1) 1MB in standard mode 2) 64MB in 386 enhanced mode 3) available virtual memory When I attempt to allocate an 18MB block*, GlobalAlloc() returns a non-zero handle, but appears to allocate a block slightly smaller than 16MB. For example: HANDLE hBig = GlobalAlloc(GMEM_MOVEABLE, EighteenMegs); char _huge *hpBig = (char _huge *)GlobalLock(hBig); ... dwSize = GlobalSize(hBig); /* dwSize < 16MB !!! */; for (i = 0; i < EighteenMegs; i++) *hpBig++ = 'X'; /* Dies around 16MB past start of block. */ My apologies if this is a well-known/much-discussed problem. * My machine is a Compaq 386/25 with 8MB+640KB memory, ~31MB swap file, with Windows running in enhanced mode. -- Martin Romano Interactive Systems, Cambridge MA (617)661-7474 x209 {encore, harvard, spdcc, think}!ima!martinr martinr@ima.ima.isc.com