From: Bill Reynolds (bill@yossarian.ucsd.edu)
Date: 06/07/93


From: bill@yossarian.ucsd.edu (Bill Reynolds)
Subject: Re: gcc on linux
Date: 7 Jun 1993 02:30:42

In article <1993Jun7.010226.16852@newstand.syr.edu> tkoprulu@lynx.cat.syr.edu (Tacettin Koprulu) writes:
   In article <f4fYEew@quack.kfu.com> benjie@quack.kfu.com (Android) writes:
>Has anyone noticed the difference between gcc on linux and on unix? I
>wrote couple of programs that deals with memory. Those programs works
>fine under a sun with unix or on a pc with dos and msc. But they don't
>work under linux with gcc. I found the problem, it was about memory,
>but I don't know how to fix it.
>
>How do I get around them? I know that I was using the standard C, so
>it should not have something to do with system dependency.

   I also have the same problem. Almost all of the programs which use
   dynamic memory allocations failed to run under linux. Is there any
   problem with segmentation of memory or might it be the insufficient
   memory in which case linux can't do swapping? Any hints or suggestions
   would be appreciated since I am using linux to run my simulations at home.

I had some code to do numerical integration that seemed to work on the
sun, and crashed on linux. At first I attributed this to bugs in
linux, and spent a lot of time and energy looking for the problem (and
imposed on some of the people in this group as well). It turned out
that the code was buggy, but the Sun malloc was basically more
forgiving about overruning array boundaries than the malloc that comes
in libc. On further testing, I found that the Sun too would give
segmentation violations or, worse, corrupted variables and wrong
results.

On a related note, is there a debugging malloc available for linux? I
tried to compile the one posted to comp.sources.?? a little while ago
(dbmalloc), but it went into an infinite loop on the tests.