home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!vnet.ibm.com
- From: ameline@vnet.ibm.com (Ian Ameline)
- Message-ID: <19930128.143034.1@almaden.ibm.com>
- Date: Thu, 28 Jan 93 17:23:50 EST
- Subject: Problems with realloc
- Newsgroups: comp.os.os2.programmer
- References: <82201@hydra.gatech.EDU>
- Organization: C-Set/2 Development, IBM Canada Lab.
- Disclaimer: This posting represents the poster's views, not those of IBM
- Lines: 32
-
- In article <82201@hydra.gatech.EDU>,
- gb8@prism.gatech.EDU (BEEBE,GARY E) writes:
- >
- >Good Morning,
- >
- >I am having a bit of trouble with realloc. I am doing a bit of program
- >development on a PS/2 Mod 70 E61 w/320 ext. SCSI. I have 16M ram. The
- >program must read a file of unknown length, a line at a time, store
- >(and find) an unknown number of sets of a uniquely formatted data. I have
- >compiled and linked the C program with the C Set/2 compiler (CSD level 0028)
- >and linker. With the warning level set to "info", I get no errors or warnings.
- >This program is non-PM based at this time. I pass it the file name and it
- >is to go off and read all the data and store it in an array of pointers to
- >pointers to the previously defined data structure.
- >The code works flawlessly until I read the 78th data entry. I then get an error
- >(and stack dump) saying that malloc generated a protection violation. I
- >stepped the program to the 77 data entry in the debugger. All data variables
- >look fine, I have no outside indications of any impending disaster. When I
- >step past the line that reallocates memory for the next data entry...death!
- >
- >If I didn't know any better, I'd suspect that realloc is trying to allocate
- >a new segment for more data and failing. But, we now have a flat memory model
- >right? I'm at a loss. This is a serious show stopper. I must be able to calloc
- >and realloc data items that can grow to greater than 64K.
- >
-
- Try using the debug alloc functions to track down what's going on.
- It sounds like you're corrupting malloc's heaps. See Chapter 13 in the
- C-Set/2 User's guide.
-
- Regards,
- Ian.
-