Date: Sat, 10 Dec 1994 00:00:48 -0500 (EST) From: john hoeschele To: mailing list Cc: john miller , ece431 group -- edward mazorowicz , jim wailing Subject: Malloc I am trying to use malloc to allocate a 2.7Mbyte chunk of memory. The program compiles with no problems but when I try to execute, no memory is allocated and it quits. Here is how the function is used: typedef struct sBuf { UCHAR vmbuf[1728]; }tBuf tBuf *Bptr[1600]; inside main: if(Bptr[0] = (tBuf *)malloc(1728*sizeof(tBuf))) printf("There has been an error is allocating memory!!"); exit(1); if it continues, I load Bptr[] with 1600 pointers to various locations in allocated memory, but I never get there. I always get the printf statement. Am I using the malloc function wrong? I tried a test program not using a structure but just putting in large numbers to equal out to 2.7Meg, and it returned an address ,so there is enough memory available. I thought about just using a two dimensional array (array[1728][1600]) but I wanted to use the malloc function. Can anyone give me any advice or input on what could a solution??? Would it be better to allocate each 1728 chunk of memory separate than the whole thing all at once?? Anything would be helpful at this point!! Thanks - John D Hoeschele