This is the mail archive of the gcc-help@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: large C Language File


On 25/05/18 05:41, 李刚 wrote:
> Hello GCC
> 
> 
> 
> 
> I have  some question about gcc when compile large C file.  I have a
> 2G C file .When compile, cannot finish.
> 
> 
> 
> 
> how large C file the GCC support ?  100M? 500M? 1G?
> 
> When compile large C file ,is there any gcc option?
> 
> 

In theory, if you have a 64-bit build of gcc there should be no specific
limit.  But in practice it is going to depend a great deal on the sort
of thing you have in the C file, and the kinds of options you have.
Some aspects of C compilation scale linearly - so a 2 GB file will
compile like 1,000 separate 2 MB files.  But other aspects are
non-linear in either time or memory space.  Then the 2 GB file is
perhaps like 1,000,000 separate 2 MB files.  So there is no easy answer
to your question.

Have you done any timings with smaller files, to see how the time grows
with the size of the code?

And have you made sure your host computer has enough memory?

Give some details of the gcc build (compiler version, 32-bit or 64-bit,
host OS, compiler flags) and some information about the source code file
(what sort of thing is in the file), and maybe people can give some
suggestions.

I am rather curious as to what you have in your C file.  I am assuming
it is not a manually written file!  Is it something like a generated
simulation for FPGA/ASIC design?

Have you looked at how you might be able to split it up into separate
files?  As well as helping compilation, that could allow you to make
more efficient results (as you will be able to use more optimisation on
smaller files).


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