Path: utzoo!attcan!uunet!super!udel!rochester!pt.cs.cmu.edu!cadre!pitt!cisunx!ejkst From: ejkst@cisunx.UUCP (Eric J. Kennedy) Newsgroups: comp.sys.amiga.tech Subject: Memory Freed Twice guru Message-ID: <12741@cisunx.UUCP> Date: 23 Sep 88 21:16:14 GMT Reply-To: ejkst@unix.cis.pittsburgh.edu (Eric J. Kennedy) Organization: Univ. of Pittsburgh, Comp & Info Sys Lines: 48 References: I've got a very persistant problem with a number crunching program I'm working on. Essentially, I have several (double *) pointers, plus a number of integer and double variables. I open a file, read some integers, and use malloc() to allocate space for arrays for the pointers, read data into the arrays, and close the file. I then call the main curve fitting routine, it does its thing (it does everything with static and automatic variables, plus the arrays whose pointers are passed to it) and returns the result. The main program prints the result, frees the space, and quits. Simple, no? Every time, the program does all of the above, prints out the *right* *answer*, and crashes. Guru 81000009, memory freed twice. Using Manx db, it always crashes in __FreeMem, with some impossibly huge value being in D0, which is supposed to be the amount of memory to free. (Gosh, I sure wish I had 1.2 Gigabytes of ram so I could free it!) I'm using Manx 3.4a. It does this under all memory models, 16 or 32 bit ints, manx or amiga ieee libraries, with or without explicitly freeing the memory in the program, and using malloc() and free() or AllocMem() and FreeMem(). Ok, you say. I've got a bug in the program. _But_ the program comes up with the right answer!! And it works perfectly on an MS-DOS machine. So what's going on? I seem to remember a discussion about the memory freed twice guru, but I don't remember the details. (Just that I wanted to remember for future reference!) If I switch to ffp instead of ieee, it doesn't do this, but it still crashes a lot. Usually 00000003 or 00000004. I need double precision, though. Any help would be greatly appreciated, because it pisses me off that after a week I finally get it working on the IBM, but it crashes my Amiga!! -- ------------ Eric Kennedy ejkst@cisunx.UUCP