How much memory does gfortran use when compiling?

Paul Thomas paulthomas2@wanadoo.fr
Sun Jul 8 14:06:00 GMT 2007


Dear All,

I attach a patch that is a first order attempt at a reorganisation of 
the parser, on which to hang whole file interface checking and speeded 
up module reading.  It was the result of a Paris/Marseille train ride 
and this is as far as I got in the time.  Not it DOES NOT regtest yet:

        === gfortran Summary ===

# of expected passes        18560
# of unexpected failures    356
# of expected failures        8
# of unresolved testcases    1
# of unsupported tests        86

All the failures, except one are segfaults because something gets messed 
up in procedure locuses.  I am sure that it is a minor problem.  The 
remaining regression results from the reversal of the order in 
resolution and code generation.

Anyway, the name of the game is to hang all the parsed program units in 
a global namespace before resolving them and turning them into code.  I 
suspect that all programme blocks, except modules could be handled in 
this way - I just have not tried yet.

Note that the gfc_free_dt_list ()'s  and the single gfc_free_namespace 
(gfc_global_ns) replace the gfc_done_2 () for the program units.  I did 
chec that everything is freed, as before.

Beyond curing the above mentioned regressions, the next stage would be 
to introduce the whole file interface checking.  Clearly, it is a 
trivial matter to search the sym_tree of gfc_global_ns for a procedure 
and to do the standard interface checking.  Beyond this, symbols for all 
the other units, including modules, should  be added to gfc_global_ns, 
to be used for name checking and gsymbols removed.  The final step would 
be to add module namespaces, exactly as they would be read from a .mod 
file.  Then read_modules, subsequent to the first call, would copy these 
namespaces, subject to need and renaming.  I suspect this later step 
will be less straightforward than the first.

Anyway, all this preamble brings me to my question:  Has anybody checked 
how much memory gfortran uses, on average, in a compilation, per byte of 
fortran?

I presume that this quantity will be fairly constant for big codes but I 
thought that I would ask if anybody had done this before I do some 
digging myself.  The reason that I ask is obvious - is the scheme that I 
outlined above viable or will it be forever leading to memory problems?

Cheers

Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interface0707.diff
Type: text/x-patch
Size: 5364 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070708/71ce9f3a/attachment.bin>


More information about the Fortran mailing list