I got this question from an RMagick user and reproduced it as a plain C program.

On my Powerbook running OS X 10.4.6, with ImageMagick 6.2.7 (4/27/06), the Activity Monitor application shows that virtual memory size of this test program grows steadily the longer the test runs. (You have to kill the test or it will run forever.) The physical memory size doesn't increase. If I change the test to use PNG format files instead of MPC format the vmsize does not increase.

Please let me know if you need any more info...

/*

Tim Hunter, [EMAIL PROTECTED]

gcc `Magick-config --cflags --cppflags` mpc.c `Magick-config -- ldflags --libs` -o mpc
*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <magick/api.h>

int main(int argc,char **argv)
{
    ExceptionInfo exception;
    Image *hat, *bighat, *work;
    ImageInfo *info;
    int x;


    InitializeMagick("mpc_test");

    puts(GetMagickVersion(NULL));

    GetExceptionInfo(&exception);

    info = CloneImageInfo(NULL);
strcpy(info->filename, "/Users/timothyhunter/RMagick/doc/ex/ images/Flower_Hat.jpg");
    hat = ReadImage(info, &exception);
    if (exception.severity != UndefinedException)
    {
printf("ReadImage: %s: %s\n", exception.reason, exception.description);
        exit(1);
    }


    for(x = 0; ; x++)
    {
bighat = ResizeImage(hat, 819, 1024, LanczosFilter, 0.0, &exception);
        if (exception.severity != UndefinedException)
        {
printf("ResizeImage: %s: %s\n", exception.reason, exception.description);
            exit(1);
        }

strcpy(bighat->filename, "/Users/timothyhunter/Temporary/ Flower_Hat.mpc");
        WriteImage(info, bighat);
        if (bighat->exception.severity != UndefinedException)
        {
printf("WriteImage: %s: %s\n", bighat->exception.reason, bighat->exception.description);
            exit(1);
        }

        DestroyImage(bighat);

strcpy(info->filename, "/Users/timothyhunter/Temporary/ Flower_Hat.mpc");
        bighat = ReadImage(info, &exception);
        if (exception.severity != UndefinedException)
        {
printf("ReadImage: %s: %s\n", exception.reason, exception.description);
            exit(1);
        }

work = ResizeImage(bighat, 819, 1024, LanczosFilter, 0.0, &exception);
        if (exception.severity != UndefinedException)
        {
printf("ResizeImage: %s: %s\n", exception.reason, exception.description);
            exit(1);
        }

        DestroyImage(bighat);

strcpy(work->filename, "/home/tim/imtests/ Flower_Hat_work.jpg");
        WriteImage(info, work);
        if (bighat->exception.severity != UndefinedException)
        {
printf("ReadImage: %s: %s\n", bighat->exception.reason, bighat->exception.description);
            exit(1);
        }

        DestroyImage(work);

        printf("%d\n", x);
    }


    DestroyImageInfo(info);
    DestroyImage(bighat);
    DestroyImage(work);
    DestroyImage(hat);
    DestroyMagick();

    return 0;
}

_______________________________________________
Magick-developers mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-developers

Reply via email to