GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DEVEL::EVENTS::OBJECTS (3)

.ds Aq ’

NAME

Devel::Events::Objects - Object tracking support for Devel::Events

CONTENTS

SYNOPSIS



        use Devel::Cycle;
        use Data::Dumper;

        use Devel::Events::Handler::ObjectTracker;
        use Devel::Events::Filter::RemoveFields;
        use Devel::Events::Generator::Objects;

        my $tracker = Devel::Events::Handler::ObjectTracker->new();

        my $gen = Devel::Events::Generator::Objects->new(
                handler => Devel::Events::Filter::RemoveFields->new(
                        fields => [qw/generator/], # dont need to have a ref to $gen in each event
                        handler => $tracker,
                ),
        );

        $gen->enable(); # start generating events

        $code->(); # check for leaks in this code

        $gen->disable();

        # live_objects is a Tie::RefHash::Weak hash

        my @leaked_objects = keys %{ $tracker->live_objects };

        print "leaked ", scalar(@leaked_objects), " objects\n";

        foreach my $object ( @leaked_objects ) {
                print "Leaked object: $object\n";

                # the event that generated it
                print Dumper( $object, $tracker->live_objects->{$object} );

                find_cycle( $object );
        }



DESCRIPTION

This package provides an event generator and a handler for Devel::Events, that facilitate leak checking.

There are two components of this module: Devel::Events::Generator::Objects, and Devel::Events::Handler::ObjectTracker.

The first one uses some trickery to generate events for every object creation and destruction in code loaded after it was loaded.

The second one will listen on these events, and track all currently living objects.

See the SYOPSIS for how to write your own leak tracker, and Catalyst::Plugin::LeakTracker for a real world application of these classes.

SEE ALSO

Devel::Events, Devel::Events::Filter::Size, Catalyst::Plugin::LeakTracker, Devel::Cycle, Devel::Leak::Object

AUTHOR

Yuval Kogman <nothingmuch@woobling.org>

COPYRIGHT & LICENSE



        Copyright (c) 2007 Yuval Kogman. All rights reserved
        This program is free software; you can redistribute it and/or modify it
        under the terms of the MIT license or the same terms as Perl itself.



Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DEVEL::EVENTS::OBJECTS (3) 2008-06-21

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.