[comp.sys.amiga.programmer] memory troubles and the Guru :-)

kxgj@vax5.cit.cornell.edu (06/30/91)

I've had recent problems with code I'm developing and would appreciate
some in.  My repeated gurus seem to be linked to memory allocation
problems (thanks again to those providing guru translation).  I noticed
memory leakage in my program and decided to add a few functions before
plugging the leak (bad idea).  At this point, I can run the program a few
times (at most) before being guru'd.  The leakage is small so it is not
running out of memory.  The most prevalent guru is a 68000 trap #3 which
a couple of people have indicated is non aligned data.  I've occasionally
gotten a 68000 trap for illegal instruction and once when using 'avail'
to track the memory I got a corrupted memory list guru.  Yes, my problem
seems to be linked to memory.  I use AllocRemeber & FreeRemember to
do almost all of my memory allocation (besides static declarations) and
am using SAS 5.10.  I've looked for the misaligned data in the code
(mainly my structures) and can't find it (but could have overlooked it).
Questions:
  1.  What is considered the best method of tracking down the memory leakage
problem?  I've made sure to close all that I've opened.  What system things
might be opened without my knowledge that I might have to deal with?
  2.  Any good suggestions on how to deal with the (very frustratingly
frequent) trap error for the misaligned data (yeah, straighten it out!!)?
Could it be something else (guru 00000003.---)?
  3.  Could improper use of floating point stuff contribute?  It was after
adding some floating point transcendentals that the gurus flew fast and
furiously.  Is there a good description of appropriate use of the different
types of floating point numbers somewhere?  I've read the terse text in the 
lattice manual but would really like to read a more detailed discussion.
What are the sizes of the different type doubles?
  4.  The compiler claims to pad structures for data alignment.
If so, why am I getting this problem.

I would prefer E-mail replies because this problemmost likely is not of
general interest but I will keep an eye on this group for awhile.

Kirk
kxgj@vax5.cit.cornell.edu
kxgj@cellf.tc.cornell.edu