openexr-devel
[Top][All Lists]
Advanced

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

[Openexr-devel] Memory leak when loading RGBA OpenEXR cubemaps


From: Godfrey Jones
Subject: [Openexr-devel] Memory leak when loading RGBA OpenEXR cubemaps
Date: Sat, 15 Oct 2005 22:10:57 +1000

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

When I have time I might try track it down myself, but it looks pretty complicated at the moment...
Thanks

-Peter

reply via email to

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