Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!decwrl!hplabs!hpda!hp-sde!hpfcdc!hpfelg!jk From: jk@hpfelg.HP.COM (John Kessenich) Newsgroups: comp.lang.c Subject: Re: Re: Malloc problems Message-ID: <690008@hpfelg.HP.COM> Date: 13 May 88 18:04:57 GMT References: <272@marob.MASA.COM> Organization: HP Elec. Design Div. -FtCollins Lines: 18 A wild guess: Malloc() has two behavoirs that combined might be causing your problem. 1. When malloc() runs out of memory, it returns NULL. 2. Free does not necessarily return memory for malloc's immediate re-use. If you repeatedly malloc and free, you may actually be using up memory. This leads to malloc eventually returning NULL, which, if you dereference, can cause a core dump. Free-ing memory in reverse order it was malloc'ed in may help. John Kessenich