Hi there,
 
I am using  DFB 1.0.0 on linux.
 
When ever i do a rendering of PNG image.
Some amount of memory will be taken by the system for rendering, 
based on the image size and color content.
 
But even though i released the image provider and the corresponding surface,
the memory released is not matching with the used.
 
So, i am facing "out of memory" after recursive image renderings.
 
Example is below:
 
#include <stdio.h>
#include <string.h>
#include <directfb.h>

/* DirectFB interfaces */
IDirectFB *dfb;
IDirectFBSurface *primary;
IDirectFBImageProvider *provider;
/* describes size, pixel format and capabilities of a surface*/
DFBSurfaceDescription dsc;
int main( int argc, char *argv[] )
{
        system("free");

        /* initalize DirectFB and pass arguments */
        DirectFBInit( &argc, &argv );
        /* create the super interface */
        DirectFBCreate( &dfb );
        system("free");

        /* set cooperative level to DFSCL_FULLSCREEN for exclusive access to the
         * primary layer */
        dfb->SetCooperativeLevel( dfb, DFSCL_FULLSCREEN );
        /* get the primary surface, i.e. the surface of the primary layer we 
have
         * exclusive access to */

        memset( &dsc, 0, sizeof(DFBSurfaceDescription) );
        dsc.flags = DSDESC_CAPS ;
                                /* only the caps field of the description is
                                valid. height, width and pixelformat are not
                                set, since the resolution and pixel are
                                determined by the current video mode */
        dsc.caps = DSCAPS_PRIMARY; /* we want the primary surface (the whole
                                screen) */
        /* Since we are in fullscreen mode no new surface will be created,
         * the whole screen will be made accessible through a IDirectFBSurface 
*/
        dfb->CreateSurface( dfb, &dsc, &primary );
        system("free");

        /* create the image provider that will load the image */
        dfb->CreateImageProvider( dfb, "Image31.png", &provider );
        system("free");

        /* render the image to the screen */
        provider->RenderTo( provider, primary, NULL );
        system("free");

        /* release the image provider, it is no longer necessary */
        provider->Release( provider );
        system("free");

        sleep (5);
        /* clean up */
        primary->Release( primary );
        system("free");

        dfb->Release( dfb );
        system("free");
        return 0;
}

 

_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to