Hi. I'm using ActiveState build 631 on Win2K. Not self compiled, just the binary download from activestate.com.
I have noticed that the way memory is allocated when hashes are created/grown varies considerably under Linux and my Win2K install. In Linux the memory usage steps up very gradually as the hash is updated (inserts, updates). But on Win2K it makes huge jumps. It seems to start with adding 8M, then 32M (8x4), then 128M (32x4), and so on (I would guess). For example, in the enclosed test script the memory footprint will run approximately like so: Iterations Memory ---------- ------ 0 .. 6,100 6 M 6,200 .. 25,000 14M (6 + 8) 26,000 .. 100,000 46M (14 + 32) 110,000 .. ? 174 (46 + 128) Now before anybody gets on me about using a more appropriate out-of-memory database, I am for a bunch of stuff but I have a need to do a part using a hash and it is possible I might hit the 32M boundary. And this would run on a user's desktop and I'd hate to grab 32M extra when I only may need 512K extra. Nothing special about my test script. I'm sure this is a FAQ but I could not find any hits to many searches. My question is can this pre-allocation amount (or whatever it is) be tuned? Can anyone explain the reason this works this way? Thanks, -Mike # Usage: simple-hash-test count use strict; my($Count) = shift || die "bad usage\n"; my($I, %Hash); my($Key) = "a"; for ($I = 1; $I <= $Count; ++$I) { # Silly sample data struct ++$Key; push(@{$Hash{imported}->{open}}, $I); push(@{$Hash{imported}->{closed}}, $I); $Hash{exported}->{open}->{$Key} = [ $I ]; $Hash{exported}->{closed}->{$Key} = [ $I ]; } -- Michael S. Muegel Dallas, Texas _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs