GPC compiler crash

Thomas Schneider schneidt at mail.nih.gov
Sun Feb 17 18:55:38 CET 2013


Chief:

> Local variables (and parameters passed by value) go on the stack, which 
> is typically very small. You can increase it in some unix systems. 
> Everything else (AFAIK) goes on the heap - which, put simply (As far as 
> I understand) is as big as all the memory available to the program 
> (installed RAM + virtual memory on the system).

Ok, I thought it might be on the heap but I had understood the heap
contained pointer structures.

> > I get segmentation faults when I run with the numbers too big
> > (trimax=2003001).  I'm somewhat puzzled by this since I have 26G free
> > Physical memory ...  I calculate that for that size it should only take
> > 32048096 = 32,048,096 = 32M integers.  What's happening?
> 
> Do this at the beginning of your program:
>   writeln (sizeof (trisquare));   
> 
> You will see exactly how big the data structure is.

Thanks for the tip!

sizeof (trisquare) =128192384
trimax =             2003001
sizeof(trisquare)/trimax =       64.0001597603

http://www.gnu-pascal.de/gpc/SizeOf.html
"Returns the size of a type or variable in bytes."

Ahh, that makes sense.  There are 16 integers per triangular array
element.  Each integer is 64 bits which is 8 bytes
... 16*8=128.  Hmm I'm still off by a factor of 2!
Ok I ran sizeof on an integer ... 4 bytes.  Fair enough, my integers
are 32 bits long.

So my structure is still only 128Mb.  I have a lot more free than
that!

Tom

  Thomas D. Schneider, Ph.D.
  Senior Investigator
  National Institutes of Health
  National Cancer Institute
  Frederick National Laboratory for Cancer Research
  Gene Regulation and Chromosome Biology Laboratory
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  schneidt at mail.nih.gov
  http://alum.mit.edu/www/toms



More information about the Gpc mailing list