delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/21/04:35:19

From: "John M. Aldrich" <fighteer AT cs DOT com>
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
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 <stdlib.h>, which declares the prototype for
malloc()?
- If you compile with the '-O' and '-Wall' switches, do you get any
warnings?

hth

-- 
John M. Aldrich <fighteer AT cs DOT com>                      

* 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019