Path: utzoo!attcan!uunet!samsung!munnari.oz.au!cluster!metro!bunyip!moondance!uqcspe!qfagus!gordon From: gordon@qfagus.OZ (Peter Gordon) Newsgroups: comp.lang.c Subject: Malloc in Turbo C Keywords: Turbo C Malloc Message-ID: <26316@qfagus.OZ> Date: 27 Feb 90 05:54:32 GMT Organization: Department of Forestry, Brisbane, Australia Lines: 33 Please tell me I'm doing something stupid. The following code works on Microsoft C and a MIPS/1000 runnung UNIX Sys V Release 4_0. On Turbo C (ver 2) it crashes after a variable number of frees. I've tried all memory models and far pointers and can't think of much else to try. Commonsense tells me that such a basic bug would not be in Version 2, would some kind person point me in the right direction. (I've tried the code on 8088, and 80386 machines, both with and without floating point emulation.) Peter Gordon. ------------------- cut here ------------------------------ echo "Extracting tst.c" sed -e 's/^X//' > tst.c << END_OF_FILE X#include X#ifdef __TURBOC__ X#include X#else X#include X#endif X#include Xmain() X{ X char **head, **cp; X int i; X head = (char **)malloc(200 * sizeof(char **)); X for(cp = head, i = 0; i < 200; ++i, ++cp) X { X fprintf(stdout,"Freeing %d\n", i); X fflush(stdout); X free(cp); X } X} END_OF_FILE