From 1abd87954c2b22862dfa204925ed77bd6a48d3d9 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Fri, 15 Mar 2013 08:43:35 -0800 Subject: [PATCH] Oops, fix gross memory leak in SolveSpace library due to failure to destroy temporary heap. [git-p4: depot-paths = "//depot/solvespace/": change = 2210] --- exposed/CDemo.c | 7 ++++++- exposed/lib.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/exposed/CDemo.c b/exposed/CDemo.c index 32a8c505..fba7f4f9 100644 --- a/exposed/CDemo.c +++ b/exposed/CDemo.c @@ -259,6 +259,11 @@ int main(void) sys.faileds = 50; // Example3d(); - Example2d(); + for(;;) { + Example2d(); + sys.params = sys.constraints = sys.entities = 0; + break; + } + return 0; } diff --git a/exposed/lib.cpp b/exposed/lib.cpp index 3084b1bf..3e462716 100644 --- a/exposed/lib.cpp +++ b/exposed/lib.cpp @@ -66,12 +66,12 @@ void Slvs_Solve(Slvs_System *ssys, Slvs_hGroup shg) #if 1 dbp("SolveSpace library initialized (evaluation version only)."); dbp("Built " __DATE__ " " __TIME__ - ". Copyright 2009-2011 Useful Subset, LLC."); + ". Copyright 2009-2013 Useful Subset, LLC."); HWND h = GetForegroundWindow(); MessageBox(h, "This is an evaluation copy of SolveSpace. To purchase a license, please " "contact info@solvespace.com.\r\n\r\n" -"Copyright 2009-2011 Useful Subset, LLC.", +"Copyright 2009-2013 Useful Subset, LLC.", "SolveSpace", MB_OK); #endif InitHeaps(); @@ -252,6 +252,8 @@ default: dbp("bad constraint type %d", sc->type); return; SK.param.Clear(); SK.entity.Clear(); SK.constraint.Clear(); + + FreeAllTemporary(); } }