Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Re: Re: Tracking Memory Leaks

by bikeNomad (Priest)
on Aug 15, 2001 at 20:47 UTC ( #105089=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Tracking Memory Leaks
in thread Tracking Memory Leaks

We're constantly loading new classes, dymanically created from database information. Now, theoretically, we have a finite number of classes, so the memory usage from loading these things should be finite itself (and that limit should be hit rather quickly). However, I'm not positive this is the case. Anyway know much about the finer points of this?

Are you cleaning up the symbol tables after you're done using these new classes, or are they being re-used? We found in Class::Prototyped that each new class takes up around 1.5-2K of memory; more (of course) with methods. You can clean up the symbol table when you're done with code like this (assumes $package does not contain '::'):

no strict 'refs'; foreach my $key ( keys %{"$package\::"} ) { delete ${"$package\::"}{$key}; } # this only works because we're not a multi-level package: delete( $main::{"$package\::"} );

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://105089]
[hippo]: Yary: There are a few useful pointers in I need perl coding standards
[hippo]: ... and a boatload of good stuff in On Coding Standards and Code Reviews
[Yary]: Looking at system pm's, looks like it's "package" on the first line, then POD, then "use;use strict; use warnings; use modules..."
[Yary]: ah thanks for those links
[hippo]: Just bear in mind that all such ideas are subjective.
[choroba]: There might be a different standard at the shop you write the code for.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2018-01-23 16:58 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (250 votes). Check out past polls.