Does mapping Gtk2::Gdk::Pixbuf produce a memory leak on perl?

57 views Asked by At

I need to load multiple sizes from same image, see my perl gtk2 code:

use utf8;
use strict;
use warnings;
use Gtk2;
use Glib qw/TRUE FALSE/;

sub cb_destroy
{
    Gtk2->main_quit;
}

sub Main {
    my $title = shift;
    Gtk2->init;
    my $window = Gtk2::Window->new('toplevel');
    $window->set_default_icon_list(
        map {
            Gtk2::Gdk::Pixbuf->new_from_file_at_scale(
                'cat-purr-icon_128.png', $_, $_, TRUE )
        } 128, 64, 48, 32, 16
    );
    $window->signal_connect(destroy => \&cb_destroy);
    $window->show_all;
    Gtk2->main;
    return 0;
}

exit Main('Testing');

The code works as expected, but I would like to know if map method of calling multiple times Gtk2::Gdk::Pixbuf->new_from_file_at_scale in Gtk2::Window->set_default_icon_list produces memory leak? If so, what would be an alternative way to deal with my goal: use multiple sizes from the same image.

0

There are 0 answers