virtual memory exhausted when optimizing

Ralph Gauges ralph.gauges@eml.villa-bosch.de
Fri Jan 24 21:02:00 GMT 2003


Hi,

I have some problems compiling some file that makes extensive use of
maps and multimaps.
So far I only have the constructor which just creates a multimap and
adds about 350 entries to it which are all string-map pairs.
The maps of those entries themselves consist of about 5 string-string
pairs each. So all in all, the data should contain no more than 2000
string-string pairs and those are no long strings (20 character max).
All entries are added via the insert statement. When I compile the
program without optimization, it compiles fine, although it already
takes a few minutes considering that it is not a long file.
But once I turn any type of optimization on, it compiles for hours and
stops with a "virtual memory exhausted" error. If I add the
-Wno-return-type switch to the g++ command, it does not use as much
memory (still several hundred megs though) but it still compiles many
hours on my 1GHz machine.
This happens with several different versions of gcc and libstdc++ so it
seems to be a general problems with my program.
I hope someone who has more knowledge of templates and compilers can
tell me why g++ needs such huge amounts of memory for my rather short
program. And maybe on how I could get around this.

Thank you very much

Ralph Gauges



More information about the Libstdc++ mailing list