Hi, gfortran seems to use much more memory at compile time when I "use" larger modules that contain many symbols, even if I "use, only" selected one. In the described situation it needs significantly more memory than "competitors".
The attached archive contains the following main program and three (3) large modules to demonstrate this. The variant with the commented lines uncommented goes beyond 500 MB virtual memory in a Linux/x86 machine. program main use mo_psas, only: setup_psas use mo_3dvar, only: obs, bg ! use mo_t_enkf, only: enkf_driver ! Uncomment to go beyond 500 MB virt ual mem. implicit none call setup_psas (obs% o, bg% grid% a, bg) ! call enkf_driver end program main Compiling this program with: % gfortran -S -fmem-report -ftime-report Memory still allocated at the end of the compilation process Size Allocated Used Overhead 8 4096 2816 96 16 16k 13k 256 64 4096 1088 40 128 4096 768 36 256 4096 2304 32 512 64k 61k 512 2048 36k 36k 288 4096 16k 16k 128 8192 8192 8192 32 32768 416k 416k 416 8388608 8192k 8192k 32 56 4096 280 40 104 20k 17k 180 92 106M 105M 958k 80 4096 80 36 88 73M 72M 661k 24 24k 15k 312 72 4096 288 36 28 9208k 9189k 107k 112 44k 37k 396 36 4096 288 44 12 10164k 10146k 178k 40 33M 33M 364k Total 240M 238M 2274k String pool entries 336041 identifiers 336041 (100.00%) slots 524288 bytes 4934k (350k overhead) table size 2048k coll/search 0.6655 ins/search 0.2790 avg. entry 15.04 bytes (+/- 0.99) longest entry 34 ??? tree nodes created (No per-node statistics) Type hash: size 1021, 175 elements, 0.084121 collisions DECL_DEBUG_EXPR hash: size 1021, 0 elements, 0.000000 collisions DECL_VALUE_EXPR hash: size 2097143, 865473 elements, 1.209451 collisions Execution times (seconds) garbage collection : 1.56 (19%) usr 0.00 ( 0%) sys 1.54 (17%) wall 0 kB ( 0%) ggc parser : 6.29 (78%) usr 0.78 (99%) sys 7.08 (79%) wall 25 1744 kB (100%) ggc symout : 0.00 ( 0%) usr 0.00 ( 0%) sys 0.01 ( 0%) wall 0 kB ( 0%) ggc TOTAL : 8.11 0.79 8.91 25 2445 kB Extra diagnostic checks enabled; compiler may run slowly. Configure with --disable-checking to disable checks. The modules are extracted from a larger project and should be sufficient to just compile the example. The project uses MPI (mpich) which is why these symbols occur quite frequently in the module files. Gfortran seems to handle the present case quite inefficiently. Maybe there is a solution that handles used modules more economically... Cheers, -ha -- Summary: gfortran huge (excessive?) memory usage with large modules Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: anlauf at gmx dot de GCC host triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30285