Mercurial > hg > orthanc-wsi
changeset 343:af8ebf590a29
fix memory leak
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 10 Dec 2024 13:07:25 +0100 |
parents | 39936650edc1 |
children | 5050be0f646b |
files | Framework/Inputs/OnTheFlyPyramidsCache.cpp Framework/Inputs/OnTheFlyPyramidsCache.h |
diffstat | 2 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Inputs/OnTheFlyPyramidsCache.cpp Tue Dec 10 12:57:40 2024 +0100 +++ b/Framework/Inputs/OnTheFlyPyramidsCache.cpp Tue Dec 10 13:07:25 2024 +0100 @@ -139,6 +139,21 @@ } + OnTheFlyPyramidsCache::~OnTheFlyPyramidsCache() + { + while (!cache_.IsEmpty()) + { + CachedPyramid* pyramid = NULL; + cache_.RemoveOldest(pyramid); + + if (pyramid != NULL) + { + delete pyramid; + } + } + } + + void OnTheFlyPyramidsCache::InitializeInstance(IPyramidFetcher *fetcher, size_t maxSize, size_t maxMemory)
--- a/Framework/Inputs/OnTheFlyPyramidsCache.h Tue Dec 10 12:57:40 2024 +0100 +++ b/Framework/Inputs/OnTheFlyPyramidsCache.h Tue Dec 10 13:07:25 2024 +0100 @@ -73,6 +73,8 @@ size_t maxMemory); public: + ~OnTheFlyPyramidsCache(); + static void InitializeInstance(IPyramidFetcher* fetcher, size_t maxSize, size_t maxMemory);