www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/10/29/10:29:30

From: Jarmo Raiha <jarmo AT ksvltd DOT FI>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Crashing linker ?
Date: Fri, 29 Oct 93 9:28:43 FST

I just got djgpp  1.10 and did some elementary tests.
What I want is a lot of virtual memory for big but maybe sparse arrays.
If I understand it correctly djgpp implements virtual memory.

I used DX486/50 with 4 Mbytes and 200 Mbytes of free disk space.
Nothing special programs were in use. No EMM, no Smartdrive, nothing
at all except MSDOS 6 with all UMB's and other tweaks disabled.

My first test was:                                          

int big[4000000]; /* 16 Mbytes */
main()
{
	printf("%d\n",big[3999999]);
}

To my surprise the linking phase was extremely slow. Continuous
disk activity for some three minutes. The program worked.
When I increased the array size to 6 million ints the linker crashed.
After four minutes the disk light went off and then nothing.
I waited for ten minutes but nothing happened. There it was sitting.
The compile phase (option -c) was quick.

What is going on. Looks like the linker is allocating memory for the
array and begins swapping and obviously trashing. I tested smaller array
sizes and it looks like the time grows exponentially with the array size.

Why would linker do that? The array is (or should be) initialized
at run time and it is not included in the executable.

Or is it the linker? All I know is that 'gcc -c big.c' goes fine
but then 'gcc big.o' seems to crash.
Is this an expected behaviour ?

Jarmo Raiha


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019