title: C++ class with template methods having many instances consuming huge amount of memory on compilation
body: <p>I have a class with template methods for wich I instantiate many other classes, like more than a hundred. The problem is that the compilation of the template class consumes a huge amount of memory, like 3GB. I assume this occurs because of many template instances. Just for detailing, the instantiated classes are Qt and QxOrm objects.
  Did somenone else had this problem too?
  Some suggest how could I reduce the memory consumption?</p>
  
  <p>Here are some parts of the code:</p>
  
  <pre><code>//The class with template methods
  
  class SGSRequestHandler : public HttpRequestHandler
  {
      public:
          SGSRequestHandler(QObject* parent = 0);
          virtual ~SGSRequestHandler();
  
          template&lt;class T&gt;
          ResponseInfo processDatabase(ODataRequestInfo&lt;T&gt;&amp; odata, qx::QxSession&amp; session) {...}
  
          template&lt;class T&gt;
          ResponseInfo httpGet(ODataRequestInfo&lt;T&gt; &amp;odata, qx::QxSession&amp; session) {...}
      ...
     }
  
  
  //Here is a example of what I do with de template class:
  
  else if (className == "class1")
       rInfo = process&lt;Class1&gt;(request, session);
  else if (className == "class2")
       rInfo = process&lt;Class2&gt;(request, session);
  ...
  else if (className == "class100")
      rInfo = process&lt;Class100&gt;(request, session);
  </code></pre>