openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] Memory leaks in 2.01


From: Michael Reinhardt
Subject: Re: [Openexr-devel] Memory leaks in 2.01
Date: Mon, 04 Nov 2013 15:58:18 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

Hi Gerhard,

I don't think you encountered a real memory leak. It just looks like one. (I stumbled upon this "leak" some time ago ;-) ). Upon creating a file - or something else that can handle Header object - a function named staticInitialize() (ImfHeader.h) is called. This function registers the basic attributes (e.g. Double, String, ...). These basic attributes are stored inside a static variable of the type LockedTypeMap (ImfAttribute.c). Afterwards, they are not touched again. The registration remains until the process ends. This is expected behaviour in my opinion. (Initialization is done once.)
Since the container for the basic attributes is a "function static  variable", it will be deleted upon exit of the calling process. (As all remaining memory allocations will do.)

This memory is allocated once. There is no growing runtime leak. Your memory leak detector is getting angry, because it checks the memory map too early. This "lazy static initialization" isn't recognized by the mem checker.

IMHO, there is no way to circumvent this behaviour without having to initialize the typemap with every creation of an FileObject. And that's not very performant.

I hope, I could allay your concerns.

Michael

Am 04.11.2013 08:04, schrieb Gerhard Huber:
Hi,

when I just create in InputFile
                EXRReadFile    exrFile(file);
                InputFile    inFile(exrFile);
I get some memory leaks. I think the problem are some unreleased Attributes. The size of the memory leaks is almost 48 Bytes and one with 104 Bytes.

Gerhard



_______________________________________________
Openexr-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/openexr-devel


----------
visit us at
Medica 2013 / Duesseldorf, Germany /20-23 November / hall 16-D54


reply via email to

[Prev in Thread] Current Thread [Next in Thread]