Messages in this thread | ![/](/images/icornerl.gif) | | Date | Fri, 18 Jul 1997 08:48:44 -0400 (EDT) | From | "Richard B. Johnson" <> | Subject | Re: malloc refuses to allocate more than 3k |
| |
On Thu, 17 Jul 1997, tk wrote: [SNIPPED] > > tmpBuffer = (char *) malloc((size_t)(fileStat.st_size + 1L)); > if (tmpBuffer == NULL) { fprintf(stderr, "FileStat.st_size was %lu\n", fileStat.st_size); fatalError ("Couldn't get memory"); } > fatalError("testing..4."); > Try this (with casts to make sure the right stuff is going to malloc). You might find that a certain file-size is 0 when accessed. Note that if this is an active file, the file size may not be correct until it is closed. For performance reasons, you don't want to close then reopen active files, so you might be attempting to use fstat() to keep track of something your code should be keeping track of locally.
Cheers, DJ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Richard B. Johnson Analogic Corporation Email : rjohnson@analogic.com, johnson@analogic.com Penguin : Linux version 2.1.44 on an i586 machine (66.15 BogoMips). Warning : It's hard to stay on the trailing edge of technology. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| ![\](/images/icornerr.gif) |