Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool2.mu.edu!sol.ctr.columbia.edu!emory!gatech!purdue!haven!mimsy!mojo!burgoyne From: burgoyne@eng.umd.edu (John R. Burgoyne) Newsgroups: comp.windows.ms.programmer Subject: Re: Huge global memory allocations Keywords: huge global memory GlobalAlloc Message-ID: <1991Jan30.024207.23383@eng.umd.edu> Date: 30 Jan 91 02:42:07 GMT References: <27A5DC96.4539@ics.uci.edu> Sender: news@eng.umd.edu (C-News) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 29 In article <27A5DC96.4539@ics.uci.edu> ddoherty@ics.uci.edu (Donald Doherty) writes: > > I need to allocate at least three segments (~180k) of type >int to global memory. This I have done using > > int huge *lpGlobalMemory; > . > hGlobalMemory = GlobalAlloc (GMEM_MOVEABLE, ~180k); > >as suggested in Petzold. > This works fine only as long as I use 64k or less of the space! >If I enter > 64k of data the system crashes with a runtime error. >Has anyone had any similar experiences? Any suggestions that might help >me through this painfull adolescence in my Windows memory management >experience? > >Thank-you! > You have to lock your memory, as in the following example: kx =(float huge *) GlobalLock(GlobalAlloc(GMEM_FIXED, sizecount*sizeof(float) ) ky =(float huge *) GlobalLock(GlobalAlloc(GMEM_FIXED, sizecount*sizeof(float) ) kz =(float huge *) GlobalLock(GlobalAlloc(GMEM_FIXED, sizecount*sizeof(float) ) Hope it helps. Robert