Mail Archives: djgpp/1997/07/21/04:35:19
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 -