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.
The main issue is that the constructor of e.g. ScanLineInputFile calls
initialize(header) and then readLineOffsets(
.).
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.
And therefore the exception catch cleanup of the function calling new
ScanLineInputFile() does not call the destructor of
ScanLineInputFile().
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.
initialize(header);
[...]
try
{
readLineOffsets(*_streamData->is,
_data->lineOrder,
_data->lineOffsets,
_data->fileIsComplete);
}
catch (IEX_NAMESPACE::BaseExc &e) {
ScanLineInputFile::~ScanLineInputFile();
throw;
}
Holger Schönberger
technical director
The day has 24 hours, if that does not suffice, I will take the night
_______________________________________________
Openexr-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/openexr-devel