GCC runs Out of memory... how to fix this !?

I’m using QNX 6.0 with gcc and when I compile,
it runs out of memory.

I tried to activate Virtual Memory, but it doesn’t seems to work at all…

Is there a specific procedure to follow
in order to compile a complex program
recently ported from Linux to QNX6 via gcc ?!

It used a lot of templates something
like 70 MB of auto-generated C++ code !
No joke only hpp/cpp files !

Currently, the memory status bars goes
from 1% to 100% in 30 seconds
and then a nice “memory exhausted” message is printed.

In theory I should have 1 GB of virtual memory,
but it doesn’t seems to use any VM,
since with or without it, it does the same thing.

I really need help, so any comments or tricks
on how to compile that C++ code
is more than welcome.

I tried to upgrade to QNX6.1,
but the code doesn’t compile with that version,
missing system header files, etc.

Sincerely yours,