Message-ID: <000b01c05f60$3ce4ca60$f504883e@gtdf> From: "Greg Holdridge" To: References: <90j6oj$fjt$1 AT news5 DOT svr DOT pol DOT co DOT uk> <7458-Tue05Dec2000234242+0200-eliz AT is DOT elta DOT co DOT il> Subject: Re: realloc causing fault Date: Wed, 6 Dec 2000 08:40:48 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Reply-To: djgpp AT delorie DOT com ---- Original Message ----- From: Eli Zaretskii To: Greg Holdridge Cc: Sent: Tuesday, December 05, 2000 9:42 PM Subject: Re: realloc causing fault > Your calculations are mistaken. You don't take into account the > overhead of each allocation (8 bytes per allocated buffer). So in > fact you allocate much more than 150KB. You also do it very even so, with 64MB plus virtual mem it should be ok. > inefficiently: allocating memopry 1 byte at a time, then reallocating > it for the next byte is about the worst memory usage I could think of. not one byte, one string. And besides, I need to allocate in array format because strings are accessed by code. Otherwise access would be very slow, if for example I used the binary tree structure I use for compression. How else could this be achieved without pre-allocation the stringtable space (I suppose if I put the numstrings in the compressed file header? LZW produces the same number of strings both ways I guess) > I could try guessing where your program crashes and why, but I don't > want to guess. Please post the full crash message printed by the > program, after running symify on it, and please show on the source I cant do this easily since the fault cause is handled by windows under a DOS-box and so no frame trace is performed - just a little grey window pops up telling me 'the DOS program was naughty and has been...' However the references I get are _malloc +545 _realloc +40 > If you want to understand that, read the source of malloc and realloc > in djlsr203.zip. There is a good reason for the address to move up. Thanks then, Greg