Oops, fix gross memory leak in SolveSpace library due to failure

to destroy temporary heap.

[git-p4: depot-paths = "//depot/solvespace/": change = 2210]
solver
Jonathan Westhues 2013-03-15 08:43:35 -08:00
parent 7919e7171d
commit 1abd87954c
2 changed files with 10 additions and 3 deletions

View File

@ -259,6 +259,11 @@ int main(void)
sys.faileds = 50; sys.faileds = 50;
// Example3d(); // Example3d();
Example2d(); for(;;) {
Example2d();
sys.params = sys.constraints = sys.entities = 0;
break;
}
return 0;
} }

View File

@ -66,12 +66,12 @@ void Slvs_Solve(Slvs_System *ssys, Slvs_hGroup shg)
#if 1 #if 1
dbp("SolveSpace library initialized (evaluation version only)."); dbp("SolveSpace library initialized (evaluation version only).");
dbp("Built " __DATE__ " " __TIME__ dbp("Built " __DATE__ " " __TIME__
". Copyright 2009-2011 Useful Subset, LLC."); ". Copyright 2009-2013 Useful Subset, LLC.");
HWND h = GetForegroundWindow(); HWND h = GetForegroundWindow();
MessageBox(h, MessageBox(h,
"This is an evaluation copy of SolveSpace. To purchase a license, please " "This is an evaluation copy of SolveSpace. To purchase a license, please "
"contact info@solvespace.com.\r\n\r\n" "contact info@solvespace.com.\r\n\r\n"
"Copyright 2009-2011 Useful Subset, LLC.", "Copyright 2009-2013 Useful Subset, LLC.",
"SolveSpace", MB_OK); "SolveSpace", MB_OK);
#endif #endif
InitHeaps(); InitHeaps();
@ -252,6 +252,8 @@ default: dbp("bad constraint type %d", sc->type); return;
SK.param.Clear(); SK.param.Clear();
SK.entity.Clear(); SK.entity.Clear();
SK.constraint.Clear(); SK.constraint.Clear();
FreeAllTemporary();
} }
} }