in reply to Re: CGI::Application + mod_perl =|!= memory leak
in thread CGI::Application + mod_perl =|!= memory leak

binmode having no use (purportedly) under linux I did not use it. I should have noted that the shortest case foo.pm is really the shortest case, that includes removing the close on the filehandle (which is going out of scope anyway), and also returning a reference to a scalar rather than the scalar itself.

Sadly, none of these sensible solutions makes the leak go awayl, but I think that returning the reference kept two copies of $image in memory - one copy dissapears once the request in completed.

diotalevi++
thankyou

I can't believe it's not psellchecked

Replies are listed 'Best First'.
Re: Re: Re: CGI::Application + mod_perl =|!= memory leak
by Aristotle (Chancellor) on May 21, 2003 at 11:54 UTC
    No, "globbish" filehandles are package variables and never go out of scope. The "best" variant would look like so:
    sub start { warn "## start"; my $self = shift; open my $fh, '<', '/path/to/some/image' or confess $!; $self->header_props(-type=>'your/mimetype'); local $/; return <$fh>; }
    Though that does of course do nothing to solve your leak.

    Makeshifts last the longest.

Re: Re: Re: CGI::Application + mod_perl =|!= memory leak
by diotalevi (Canon) on May 21, 2003 at 13:53 UTC

    If I recall correctly, binmode is something that unix denizens are going to have to use religiously in the future for the perl5 line. So far it isn't a big deal for Linux folk but I seem to recall that around 5.10.x it'll be something you'll need to have done.

    Anyway, its only proper to flag your filehandle so it can handle the right data appropriately.