Article View: comp.os.os2.programmer
Article #3701Problems with realloc
From: BEEBE,GARY E
Date: Thu, 28 Jan 1993 14:53
Date: Thu, 28 Jan 1993 14:53
33 lines
1937 bytes
1937 bytes
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.
If anyone has any suggestions on how to resolve this please e-mail me a note.
Thanz
--
BEEBE,GARY E
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gb8
Internet: gb8@prism.gatech.edu
Technical Details
Message-ID:
<82201@hydra.gatech.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!destroyer!gatech!prism!gb8Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!gatech!prism!gb8 From: gb8@prism.gatech.EDU (BEEBE,GARY E) Newsgroups: comp.os.os2.programmer Subject: Problems with realloc Keywords: errors realloc Message-ID: <82201@hydra.gatech.EDU> Date: 28 Jan 93 14:53:47 GMT Organization: Georgia Institute of Technology Lines: 33