MSVC: work around binary size explosion.

This commit is contained in:
EvilSpirit 2016-04-20 13:50:41 +06:00 committed by whitequark
parent d2b21666e1
commit dabd57847e

View File

@ -681,7 +681,8 @@ public:
class SolveSpaceUI { class SolveSpaceUI {
public: public:
TextWindow TW; TextWindow *pTW;
TextWindow &TW;
GraphicsWindow GW; GraphicsWindow GW;
// The state for undo/redo // The state for undo/redo
@ -923,7 +924,8 @@ public:
bool ActiveGroupsOkay(void); bool ActiveGroupsOkay(void);
// The system to be solved. // The system to be solved.
System sys; System *pSys;
System &sys;
// All the TrueType fonts in memory // All the TrueType fonts in memory
TtfFontList fonts; TtfFontList fonts;
@ -945,6 +947,18 @@ public:
static void MenuHelp(int id); static void MenuHelp(int id);
void Clear(void); void Clear(void);
// We allocate TW and sys on the heap to work around an MSVC problem
// where it puts zero-initialized global data in the binary (~30M of zeroes)
// in release builds.
SolveSpaceUI()
: pTW(new TextWindow({})), TW(*pTW),
pSys(new System({})), sys(*pSys) {}
~SolveSpaceUI() {
delete pTW;
delete pSys;
}
}; };
extern SolveSpaceUI SS; extern SolveSpaceUI SS;