|
From: | Schoenberger |
Subject: | Re: [Openexr-devel] Memory leaks reading unfinished .exr files |
Date: | Mon, 26 Mar 2018 21:29:48 +0200 |
Hi Everyone I had some time to dig into the issue myself and would like to send you my thought on how to fix it.
initialize() allocates memory for all lines. readLineOffsets() throws an exception because the file is not complete. As the exception happens in the constructor, “new ScanLineInputFile()” returns NULL. If I catch the exception in the constructor and call the destructor, I was able to reduce the memory leak from 600KB to 3KB so far.
[...] { readLineOffsets(*_streamData->is, _data->lineOrder, _data->lineOffsets, _data->fileIsComplete); } catch (IEX_NAMESPACE::BaseExc &e) { ScanLineInputFile::~ScanLineInputFile(); throw; } Holger Schönberger |
[Prev in Thread] | Current Thread | [Next in Thread] |