No, there isn't any way that I've ever heard of manually triggering the
garbage collector. If memory consumption is an issue then consider doing
refcount checks. This is sort of advanced stuff but you'll run into it
alot if you read perlguts and the like. The general idea is that if there
is a reference to something then it sticks around. You can force the issue
by delinking it earlier and and ensuring that other things don't have
references to it. There are some Devel:: modules that are supposed to help
with this sort of thing. Go check them out. Also consider seeing how much
memory perl allocates just for -e "while(<>){}". That would give you an
idea of the *absolute* minimum for process size. Remember that Perl
re-implements portions of libc so it has more baggage to carry around than
other things. The point behind that replacement libc is to make
cross-platform Perl sane. That's one of the really nice things about perl.
I can develop on my W2k machine and put it to work on the BSD box.
BTW, that 400MB in-memory hash was on a machine with 512MB of ram and only
has to be run once a year so that's not a normal thing.
Josh
Uwe Mayer <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
04/12/2002 04:25 PM
Please respond to Uwe Mayer
To: Perl-Active Perl <[EMAIL PROTECTED]>
cc:
Subject: Re[2]: where does all the memory go?
Hallo Jenda,
JK> Just for others ... if your hashes grow this big consider using
JK> DB_File or some other DBM module. Even if you do not need to
JK> persist the data, it's better to use the caching built in the DBM
JK> library than to force the OS to swap excessively. Just do not leave
JK> those huge DBMs around when your script ends if you do not need
JK> to.
JK> And really ... I would not consider 6.7MB that bad. Yes it could be
JK> smaller but well ... memory is cheap, programmers are expensive.
Sure. I've got 196 MB Ram, its just: you got this program, it works,
its just as you'd like
it (that's why you program, right?) and all that bothers you is that
your program takes up 670% more memory than you'd like it to have.
If I had a clue what it is doing it wouldn't bother me so much - at
least if I knew it was necessary.
Perhaps I've got some reference to a data structure I don't need any
more...
Is it possible to deliberatly start the perl garbage collector to go
over it?
Ciao
Uwe
--
Lowery's Law: If it jams -- force it. If it breaks, it needed
replacing anyway.
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs