| From 5ef079e305fdfe7275e6a241704fb071f7c9345d Mon Sep 17 00:00:00 2001 |
| From: "R. Clint Whaley" <whaley@cs.utsa.edu> |
| Date: Sat, 2 Nov 2013 13:04:29 -0500 |
| Subject: [PATCH] fixed possible memory leek in threaded QR |
| |
| |
| AtlasBase/Students/qr.base | 12 ++++++------ |
| 1 file changed, 6 insertions(+), 6 deletions(-) |
| |
| diff --git a/src/threads/lapack/ATL_tgeqr2.c b/src/threads/lapack/ATL_tgeqr2.c |
| index 2263042..daf44a9 100644 |
| |
| |
| @@ -10372,7 +10372,7 @@ int ATL_tgexx2(int M, int N, TYPE *A, int LDA, TYPE *TAU, TYPE *WORK, |
| /* We use a data-owner split, each thread gets 1/p of the data, */ |
| /* and does all computation related to it. */ |
| /*----------------------------------------------------------------------------*/ |
| - TYPE *myA = A, *myOldA = A, *allMem, *workMem; |
| + TYPE *myA = A, *myOldA = A, *allMem=NULL, *workMem; |
| int i, j, k, b0, b, th; |
| long unsigned int CPU; |
| size_t mem[ATL_NTHREADS], totmem, workSize; |
| @@ -10523,9 +10523,8 @@ int ATL_tgexx2(int M, int N, TYPE *A, int LDA, TYPE *TAU, TYPE *WORK, |
| ATL_goparallel(th, ATL_geqr2Worker, ts, NULL); |
| |
| |
| - #if defined(local_copy) |
| - free(allMem); /* release copied area. */ |
| - #endif /* defined(local_copy) */ |
| + if (allMem) |
| + free(allMem); /* release copied area. */ |
| free(workMem); /* release work area. */ |
| return(0); /* Done with dgeqr2. */ |
| } /* END ATL_t_dgeqr2. */ |
| diff --git a/src/threads/lapack/ATL_tgeql2.c b/src/threads/lapack/ATL_tgeql2.c |
| index 2263042..daf44a9 100644 |
| |
| |
| @@ -11660,7 +11659,7 @@ int ATL_tgexx2(int M, int N, TYPE *A, int LDA, TYPE *TAU, TYPE *WORK, |
| /* We use a data-owner split, each thread gets 1/p of the data, */ |
| /* and does all computation related to it. */ |
| /*----------------------------------------------------------------------------*/ |
| - TYPE *myA = A, *allMem, *workMem; |
| + TYPE *myA = A, *allMem=NULL, *workMem; |
| int i, j, k, b0, b, th; |
| long unsigned int CPU; |
| size_t mem[ATL_NTHREADS], totmem, workSize; |
| @@ -11823,7 +11822,8 @@ int ATL_tgexx2(int M, int N, TYPE *A, int LDA, TYPE *TAU, TYPE *WORK, |
| ATL_goparallel(th, ATL_geql2Worker, ts, NULL); |
| |
| |
| - if (myCopy) free(allMem); /* release copied area. */ |
| + if (allMem) |
| + free(allMem); /* release copied area. */ |
| free(workMem); /* release work area. */ |
| return(0); /* Done with dgeql2. */ |
| } /* END ATL_t_dgeql2 */ |