Memory leak?

Michael Thaler michael.thaler at
Wed Oct 12 14:07:14 CEST 2005


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

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?


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.


More information about the kimageshop mailing list