From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Allocation of memory. Date: Sun, 20 Jul 1997 22:19:33 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 38 Message-ID: <33D28EF5.69F2@cs.com> References: <33D210A6 DOT 5EDF AT lr DOT net> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp101.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Isaac Waldron wrote: > > I am trying to dynamically allocate memory for a buffer. I wrote a > header file that loads and displays pcx files. I need to use a buffer > for the decompressed image. > [code snipped] > It always exits with a "Not enough memory" error. > > Any help would be appreciated. Please try to post the exact code that you use. You may have made some error that doesn't show up in your example. But here are some things to check: - Is 'bufsize' initialized? - Do you in fact have enough free memory? (run 'go32-v2' without arguments) - Does replacing 'bufsize' in the call to malloc() with a constant value like 10 work? - Have you #included , which declares the prototype for malloc()? - If you compile with the '-O' and '-Wall' switches, do you get any warnings? hth -- John M. Aldrich * Anything that happens, happens. * Anything that, in happening, causes something else to happen, causes something else to happen. * Anything that, in happening, causes itself to happen again, happens again. * It doesn't necessarily do it in chronological order, though. --- Douglas Adams