From: sunegn AT image DOT dk (Sune Nielsen) Newsgroups: comp.os.msdos.djgpp Subject: Re: Newbie: HELP! It won't work!!!! Message-ID: <37fb26a2.3657145@news.image.dk> References: <37f92508 DOT 181091 AT news DOT image DOT dk> <37F9359C DOT DDC426F2 AT hmc DOT edu> X-Newsreader: Forte Agent 1.5/32.451 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 82 Date: Tue, 05 Oct 1999 16:31:48 GMT NNTP-Posting-Host: 212.54.73.79 X-Complaints-To: news-abuse AT wol DOT dk X-Trace: news010.image.dk 939134042 212.54.73.79 (Tue, 05 Oct 1999 16:34:02 MET DST) NNTP-Posting-Date: Tue, 05 Oct 1999 16:34:02 MET DST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Mon, 04 Oct 1999 16:17:48 -0700, Nate Eldredge wrote: >Sune Nielsen wrote: >> >> Please don't rip my head off for posting this rather longish email, >> but I seriously need help :( >> >> I've recently upgraded DJGPP from version 2.01 to 2.02, and now, for >> some reason of which I have absolutely no idea, it compiles my code >> into completely rubbish. Well... it actually compiles rather fine, but >> when I try to run the program it tells me something like >> >> ---------------------- >> Call frame traceback: >> in function malloc+99 >> in function _flsbuf+76 >> etc... >> --------------------- >> >> I mean "malloc"... I donīt even use that function (itīs supposed to be >> C++ ;) >> Have I totally missed some point or... is my code really that buggy? I >> am positive that it worked under v2.01! > >It's very likely to be a bug in your code. v2.02 introduced a new >implementation of malloc (and C++'s `new' and `delete' are built on top >of the `malloc' family) that happens to be much less tolerant of >erroneous behavior like overrunning arrays and multiple freeing. > >Note that your traceback doesn't necessarily point to the buggy code; >often something like an overrun will corrupt malloc's internal state and >cause it to crash on a later, valid operation. > >Anyway, you should start hunting the bug. An automated malloc checking >tool is often helpful in cases like these. I've written one called YAMD >available from > >http://www3.hmc.edu/~neldredge/yamd/ > >There are others on Simtelnet if you prefer. I think somewhat you're right! And I tried to download your YAMD, but it was way too complicated for me (hey, I'm a newbie:), so I tried some serious debugging through RHIDE instead, and guess what... when I altered this bit of code... ... struct facet { facet *nextfacet; vertex vertex_array[2]; ^^^ ... into ... struct facet { facet *nextfacet; vertex vertex_array[3]; ^^^ ... it all worked out :), but now Iīm more or less confused... When I declare an array eg, int array[3]; should I index it from 0 through 2 or should it be from 1 through 3, or could it even be from 0 through 3!? I know this is really basic C-stuff, but the Kris Jamsa book I use apparently doesn't clearify this thoroughly (I'm confused anyway, 'cos I though I understood it)... Thanks for your help, Sune Nielsen sunegn AT image DOT dk