|
From: | Godfrey Jones |
Subject: | Re: [Openexr-devel] Memory leak when loading RGBA OpenEXR cubemaps |
Date: | Thu, 20 Oct 2005 09:53:54 +1000 |
What version of OpenEXR are you using, and on what operating
system does the leak occur? (Before releasing our code, we
usually run our set of confidence tests through valgrind to
check for leaks, but obviously we didn't catch this one.)
Florian
Godfrey Jones wrote:
> I'm wondering if anyone else has found this... I'm guessing not since
> its there!
>
> Imf::RgbaInputFile fin(in_stream);
>
> // find out if we're an environment map
> if(hasEnvmap(fin.header()))
> {
> // make sure its a cubemap
> Envmap type = envmap(fin.header());
>
> if(type != ENVMAP_CUBE)
> {
> return false;
> }
> bCubemap = true;
> }
>
> Imath::Box2i win = fin.dataWindow();
> Imath::V2i dim( win.max.x-win.min.x+1 ,
> win.max.y-win.min.y+1);
>
> // remember the width and height
> m_iWidth = dim.x;
> m_iHeight = dim.y;
>
> // allocate space
> m_RgbaData = new Imf::Rgba[m_iWidth*m_iHeight];
>
> int dx(win.min.x), dy(win.min.y);
>
> fin.setFrameBuffer(m_RgbaData-dx-dy*dim.x, 1, dim.x);
> fin.readPixels(win.min.y, win.max.y);
>
>
>
> This causes 21 leaks of a 24byte object, and one of a 12byte object.
> If I comment out fin.readPixels(win.min.y, win.max.y) it doesnt happen,
> so it must be the OpenEXR library doing it. I couldnt see anything in
> the documentation about something I should be calling to free the
> library's internal data structures either.
>
> Of course, its not m_RgbaData leaking because thats huge, and is
> definitly being deleted.
>
> I've narrowed it down to that line, loading the sample cubemap provided
> on www.openexr.org <http://www.openexr.org>
>
> When I have time I might try track it down myself, but it looks pretty
> complicated at the moment...
> Thanks
>
> -Peter
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Openexr-devel mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/openexr-devel
[Prev in Thread] | Current Thread | [Next in Thread] |