Memory leak?

Michael Thaler michael.thaler at physik.tu-muenchen.de
Wed Oct 12 14:07:14 CEST 2005


Hello,

I think I introduced a memory leak in the dropshadow plugin. I do the 
following:

KisLayerSP shadowLayer = new 
KisLayer( KisColorSpaceFactoryRegistry::instance() -> 
getColorSpace(KisID("RGBA",""),"" ), "Shadow");
    KisLayerSP bShadowLayer;
...
if( blurshadow )
    {
        bShadowLayer = new KisLayer( KisColorSpaceFactoryRegistry::instance() 
-> getColorSpace(KisID("RGBA",""),"" ), "bShadow");
        gaussianblur(shadowLayer, bShadowLayer, rect, blurradius, blurradius, 
BLUR_RLE, progress);
        shadowLayer = bShadowLayer;
    }

I think I should do something like 

delete  shadowLayer

before I do 

 shadowLayer = bShadowLayer

But that crashed Krita. Basically shadowLayer is the original shadowLayer and 
bShadowLayer holds the blurred version of the shadow. So after I blurred the 
shadow, I want shadowLayer to point to the blurred version. How should I 
delete the original ShadowLayer?

Greetings,
Michael

P.S.: I also wrote a filter that uses gimps gaussian blur to blur an image. It 
works really fast also with really huge kernels like 25x25. The problem is, 
that it is RGBA8 only for the moment, so I wont commit it. For the dropshadow 
plugin this is not a problem, since the shadow layer is always RGBA8 for now, 
anyway. (I don't know if this makes sense or not). For noe basically the 
whole gaussian blur filter is in the dropshadow plugin source.

Greetings,
Michael


More information about the kimageshop mailing list