This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Advice requested: how big can we be?


>  >  > Then let's add a configure check -
>  > 
>  > How?
>  > 
> 
> Well to answer your question, write a snippet which uses malloc:
> 
> 	foo = malloc (512Mb)
> 	if (!foo)
> 	  return bad;
> 	memset (foo, 0, 512Mb)
> 	return good;
> 
> You have to make sure to access the returned memory with memset or
> something.  E.g. on some versions of Irix, when you exceed the
> available swap, malloc would return a valid pointer but you'd crash
> when you accessed the memory.  See the end of this message:
> http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html

Some linux kernel / configurations also will crash or crawl to a halt
when you do this - and sometimes the difference between the two is only
the sound of the disk drive.

And even on machines where the test returns meaningful results
(which also depends on the systemwide workload), it is asking
for debugging trouble if you silently generate different libraries
depending on the build system configuration and workload.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]