[Pntool-developers] SF.net SVN: pntool:[183] spnbox
Brought to you by:
compaqdrew,
miordache
From: <Ste...@us...> - 2009-07-07 20:15:39
|
Revision: 183 http://pntool.svn.sourceforge.net/pntool/?rev=183&view=rev Author: StephenCamp Date: 2009-07-07 20:15:31 +0000 (Tue, 07 Jul 2009) Log Message: ----------- Fixed a bug in DeallocateIlpadm (deallocation.c). Fixed memory leaks in most of the test routines. Added a readme file. Modified Paths: -------------- spnbox/deallocation.c spnbox/spnbox.h spnbox/tests/Makefile spnbox/tests/test-actn.c spnbox/tests/test-ilpadm.c spnbox/tests/test-ipsolve.c spnbox/tests/test-linenf.c spnbox/tests/test-msplit.c spnbox/tests/test-nltrans.c spnbox/tests/test-pn2acpn.c spnbox/tests/test-pn2eacpn.c spnbox/tests/test-reduce.c spnbox/tests/test-supervis.c spnbox/tests/test-tactn.c Modified: spnbox/deallocation.c =================================================================== --- spnbox/deallocation.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/deallocation.c 2009-07-07 20:15:31 UTC (rev 183) @@ -13,7 +13,7 @@ if (m) free(m); } -void DeallocateSupervise(supervis_r *data) +void DeallocateSupervis(supervis_r *data) { FreeMatrixSafe(&data->Dfm); FreeMatrixSafe(&data->Dfp); @@ -37,8 +37,8 @@ FreeMatrixSafe(&data->La); FreeMatrixSafe(&data->R1); FreeMatrixSafe(&data->R2); - FreeMemorySafe(&data->ba); - FreeMemorySafe(&data->dhow); + FreeMemorySafe(data->ba); + FreeMemorySafe(data->dhow); memset(data, 0, sizeof(ilpadm)); } Modified: spnbox/spnbox.h =================================================================== --- spnbox/spnbox.h 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/spnbox.h 2009-07-07 20:15:31 UTC (rev 183) @@ -133,7 +133,7 @@ } issiph_r; /*Functions to free return structures. Implemented in deallocation.c*/ -void DeallocateSupervise(supervis_r *data); +void DeallocateSupervis(supervis_r *data); void DeallocateIpslv(ipslv_r *data); void DeallocateIpsolve(ipsolve_r *data); void DeallocateIlpadm(ilpadm_r *data); Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/Makefile 2009-07-07 20:15:31 UTC (rev 183) @@ -26,10 +26,10 @@ TACTN=tactn.o $(IPSOLVE) #Common test header dependencies. -COMMONHEADER=spnbox.h test.h ../../pnheaders/pns.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h StructuredIO.h +COMMONHEADER=../spnbox.h test.h ../../pnheaders/pns.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h StructuredIO.h #Targets -all: ipsolve isadm issiph msplit pn2acpn supervis actn ilpadm linenf nltrans pn2eacpn reduce tactn +all: ipslv ipsolve isadm issiph msplit pn2acpn supervis actn ilpadm linenf nltrans pn2eacpn reduce tactn ipslv: test-ipslv.o $(IPSLV) $(COMPILER) -o ipslv.exe test-ipslv.o $(IPSLV) ipsolve: test-ipsolve.o $(COMMON) $(IPSOLVE) @@ -68,7 +68,7 @@ $(COMPILER) -c ../actn.c chkcons.o: ../spnbox.h ../../pnheaders/matrix.h ../../pnheaders/pns.h ../chkcons.c $(COMPILER) -c ../chkcons.c -deallocation.o: ../spnbox.h +deallocation.o: ../deallocation.c ../spnbox.h $(COMPILER) -c ../deallocation.c general.o: ../../pnheaders/general.c ../../pnheaders/general.h $(COMPILER) -c ../../pnheaders/general.c Modified: spnbox/tests/test-actn.c =================================================================== --- spnbox/tests/test-actn.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-actn.c 2009-07-07 20:15:31 UTC (rev 183) @@ -64,6 +64,7 @@ printf("Result:\n"); DisplayStructure(OutputDesc, OutFilled, &Da, &result.Dma, &result.Dpa, &Dra, &result.Dmra, &result.Dpra, result.TA, result.TACount, result.unique); FreeMemory(&memory); + DeallocateActn(&result); memory = CreateMemoryManager(10, 10, 0, 0); printf("-----------------------------------------------------------------\n"); } Modified: spnbox/tests/test-ilpadm.c =================================================================== --- spnbox/tests/test-ilpadm.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-ilpadm.c 2009-07-07 20:15:31 UTC (rev 183) @@ -35,12 +35,10 @@ answer = ilpadm(InFilled[3] ? &L : 0, InFilled[4] ? B : 0, InFilled[0] ? &D : 0, TucCount, InFilled[1] ? Tuc : 0, TuoCount, InFilled[2] ? Tuo : 0, InFilled[5] ? m0 : 0); OutFilled[0] = 1; - OutFilled[1] = 1; - ManageMatrix(&mem, &answer.La); + OutFilled[1] = 1; if (answer.ba) { - OutFilled[2] = 1; - ManageMemory(&mem, answer.ba); + OutFilled[2] = 1; } else { @@ -54,6 +52,7 @@ /*Clear and re-initialize dynamic memory log and loop again.*/ FreeMemory(&mem); + DeallocateIlpadm(&answer); mem = CreateMemoryManager(10, 10, 0, 0); } FreeMemory(&mem); Modified: spnbox/tests/test-ipsolve.c =================================================================== --- spnbox/tests/test-ipsolve.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-ipsolve.c 2009-07-07 20:15:31 UTC (rev 183) @@ -62,6 +62,7 @@ DisplayStructure(OutDesc, OutFilled, result.mhow, result.res, NumberOfColumns(L)); FreeMemory(&mem); + DeallocateIpsolve(&result); mem = CreateMemoryManager(10, 10, 0, 0); } FreeMemory(&mem); Modified: spnbox/tests/test-linenf.c =================================================================== --- spnbox/tests/test-linenf.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-linenf.c 2009-07-07 20:15:31 UTC (rev 183) @@ -62,8 +62,7 @@ OFilled[2] = 1; } if (sol.ms0) - { - ManageMemory(&memory, sol.ms0); + { OFilled[3] = 1; } if (sol.how) @@ -72,19 +71,16 @@ } if (sol.Lf.type) { - ManageMatrix(&memory, &sol.Lf); OFilled[5] = 1; Constraints = NumberOfRows(sol.Lf); } if (sol.Cf.type) { - ManageMatrix(&memory, &sol.Cf); OFilled[6] = 1; Constraints = NumberOfRows(sol.Cf); } if (sol.bf) { - ManageMemory(&memory, sol.bf); OFilled[7] = 1; } @@ -104,6 +100,7 @@ } printf("---------------------------------------------------------------\n"); FreeMemory(&memory); + DeallocateLinenf(&sol); memory = CreateMemoryManager(15, 15, 0, 0); } FreeMemory(&memory); Modified: spnbox/tests/test-msplit.c =================================================================== --- spnbox/tests/test-msplit.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-msplit.c 2009-07-07 20:15:31 UTC (rev 183) @@ -61,7 +61,7 @@ DisplayStructure(SolutionFormat, ResultMask, &Return.Dfm, &Return.Dfp, &Return.Df, &Return.Mf, &Return.L0f, &Return.Lf, Return.iplf, Return.ipCountf, ResultTDVector, OverallTDCount, Return.TDfCount, Transitions); FreeMemory(&memory); - + DeallocateMsplit(&Return); memory = CreateMemoryManager(10, 10, 0, 0); printf("---------------------------------------------\n"); } @@ -87,27 +87,21 @@ if (NumberOfRows(Data->Mf)) { Mask[3] = 1; - ManageMatrix(mem, &Data->Mf); } if (NumberOfRows(Data->L0f)) { Mask[4] = 1; - ManageMatrix(mem, &Data->L0f); } if (NumberOfRows(Data->Lf)) { Mask[5] = 1; - ManageMatrix(mem, &Data->Lf); } if (Data->iplf) { Mask[6] = 1; - ManageMemory(mem, Data->iplf); } if (Data->TDf) { - ManageMemory(mem, Data->TDf); - ManageMemory(mem, Data->TDfCount); Mask[7] = 1; Mask[8] = 1; /*Count the total size of all the TD vectors combined.*/ @@ -115,9 +109,6 @@ for (i = 0; i < NumberOfColumns(Data->Dfm); i++) { c += Data->TDfCount[i]; - /*While we're at it, add the TD arrays to the list of memory to be freed - at the end of the program.*/ - ManageMemory(mem, Data->TDf[i]); } Ret = mcalloc(mem, c, sizeof(int)); *TotalTDCount = c; Modified: spnbox/tests/test-nltrans.c =================================================================== --- spnbox/tests/test-nltrans.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-nltrans.c 2009-07-07 20:15:31 UTC (rev 183) @@ -37,6 +37,7 @@ Filled[1] = 1; DisplayStructure("arrayi FinalURTMask", Filled, solution.dtr, solution.dtrCount); FreeMemory(&mem); + DeallocateNltrans(&solution); mem = CreateMemoryManager(5, 5, 0, 0); } FreeMemory(&mem); Modified: spnbox/tests/test-pn2acpn.c =================================================================== --- spnbox/tests/test-pn2acpn.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-pn2acpn.c 2009-07-07 20:15:31 UTC (rev 183) @@ -73,6 +73,7 @@ DisplayStructure(OutputDesc, ResFilled, &result.Df, &result.Dmf, &result.Dpf, &result.MXF, &result.L0F, &result.LF, result.iplf, result.iplfCount); printf("---------------------------------------------------------------------------\n"); FreeMemory(&mem); + DeallocatePn2acpn(&result); mem = CreateMemoryManager(5, 5, 0, 0); } FreeMemory(&mem); Modified: spnbox/tests/test-pn2eacpn.c =================================================================== --- spnbox/tests/test-pn2eacpn.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-pn2eacpn.c 2009-07-07 20:15:31 UTC (rev 183) @@ -74,6 +74,7 @@ DisplayStructure(OutputDesc, ResFilled, &result.Df, &result.Dmf, &result.Dpf, &result.MXF, &result.L0F, &result.LF, result.iplf, result.iplfCount, result.TD, result.TDCount, NumberOfColumns(result.Df)); printf("---------------------------------------------------------------------------\n"); FreeMemory(&mem); + DeallocatePn2eacpn(&result); mem = CreateMemoryManager(5, 5, 0, 0); } FreeMemory(&mem); Modified: spnbox/tests/test-reduce.c =================================================================== --- spnbox/tests/test-reduce.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-reduce.c 2009-07-07 20:15:31 UTC (rev 183) @@ -32,6 +32,7 @@ printf("Result:\n"); DisplayStructure(OutputDesc, OutFilled, &result.Lf, result.Bf, NumberOfRows(result.Lf), result.indf, NumberOfRows(result.Lf), result.how); FreeMemory(&memory); + DeallocateReduce(&result); memory = CreateMemoryManager(4, 1, 0, 0); printf("-----------------------------------------------------------------\n"); } Modified: spnbox/tests/test-supervis.c =================================================================== --- spnbox/tests/test-supervis.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-supervis.c 2009-07-07 20:15:31 UTC (rev 183) @@ -59,6 +59,7 @@ } printf("---------------------------------------------------------------\n"); FreeMemory(&mem); + DeallocateSupervis(&result); mem = CreateMemoryManager(1, 5, 0, 0); } FreeMemory(&mem); Modified: spnbox/tests/test-tactn.c =================================================================== --- spnbox/tests/test-tactn.c 2009-07-07 19:11:31 UTC (rev 182) +++ spnbox/tests/test-tactn.c 2009-07-07 20:15:31 UTC (rev 183) @@ -62,6 +62,7 @@ printf("Result:\n"); DisplayStructure(OutputDesc, OutFilled, &Da, &result.Dma, &result.Dpa, &Dra, &result.Dmra, &result.Dpra, result.TA, result.TACount, result.unique); + DeallocateTactn(&result); FreeMemory(&memory); memory = CreateMemoryManager(10, 10, 0, 0); printf("-----------------------------------------------------------------\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |