I have case where the order of the USE statements have a huge effect on the compiler's memory usage.
The attached archive contains two folders, one called memory_usage and another called build_memory_usage. To build the example it should be as simple as:
$ cd build_memory_usage $ cmake ../memory_usage $ make
Hence, it is necessary to have cmake installed to build the test examples.
As the code is now, it should build without any problem until it reaches the test_body (its source is located memory_usage/src/tests). I can not build it with 4GB ram. But there are several ways to make the program compile, but I do not think they should be relevant:
1) Commenting out USE HS2String ensures that the program compiles, and as the comments in that program explain: It is also possible to use the same statement at the beginning of the list of USE statements without any issue.
2) Remove "USE HS2Orbit, ONLY: HSJPLOrbit" in each of the appos funtions within "memory_usage/src/libs/hsspace/hsbody/hsbody.f90" and adding one at the beginning of the module (and leaving test_body.f90 in its original state)
3) Remove all code relevant to the private object HSNumOrbit in "memory_usage/src/libs/hsspace/hsorbit/hsorbit.f90" and the code compiles with reasonable memory usage again (that is a few percent of the available ram)
This is with intel fortran 2013.0.079 on openSUSE 12.2 x86_64