I would guess that it is a threshold problem. Some categories have a maximum size. For instance, an integer in
VB can only be 32,767 to -32,768. You don't run out of memory if you exceed that, you exceed the gizmos limitations.
Now, integers are automatically checked for exceeding that, but you might be encountering some more subtle area that nonetheless has a threshhold.
The next thing I would try would be putting parts of the functionality that you need and put it into different templates, so that the whole app is not in just one template.
Also, be sure to limit your use of global items.