Skip to content

Instantly share code, notes, and snippets.

@Jeansen
Created April 8, 2017 08:32
Show Gist options
  • Save Jeansen/0f77522e92f5aeabe3084abccef4ea5b to your computer and use it in GitHub Desktop.
Save Jeansen/0f77522e92f5aeabe3084abccef4ea5b to your computer and use it in GitHub Desktop.
overlay test - consuming more and more memory
#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
use 5.10.1;
use autodie;
use constant {GAUGE => '▪'};
sub on_start {
my ($self) = @_;
my $rend = urxvt::OVERLAY_RSTYLE;
$rend = urxvt::SET_BGCOLOR $rend, 1;
$rend = urxvt::SET_FGCOLOR $rend, 255;
$self->{net} = urxvt::timer
->new
->start ( 1 + int urxvt::NOW )
->interval ( 1 )
->cb ( sub {
for (1..1000) {
$rend = urxvt::SET_FGCOLOR $rend, 4;
$self->{netOverlay} = $self->overlay ( -1, 0, 1, 1, $rend, 0 );
$self->{netOverlay}->set ( 0, 0, GAUGE );
$self->{netOverlay}->hide;
$self->{netOverlay}->show;
}
} );
()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment