Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello fellas
I'm using the following script from mit
The code looks like so:
#!/usr/bin/perl -w BEGIN { unshift @INC, "lib" } use strict; use SNMP::MIB::Compiler; use Data::Dumper; my $DATE = '1999/05/06'; my $outdir = 'out'; my $file = shift || die "Usage: $0 MIBNAME\n"; $Data::Dumper::Purity = 1; $Data::Dumper::Indent = 1; $Data::Dumper::Terse = 1; my $mib = new SNMP::MIB::Compiler; $mib->add_path('mibs', 'mibs/cisco', 'mibs/com21', '/home/ftp/doc/mibs/ascend'); $mib->add_extension('', '.mib', '.my'); mkdir $outdir, oct 755 unless -d $outdir; $mib->repository($outdir); $mib->{'accept_smiv1'} = 1; $mib->{'accept_smiv2'} = 1; $mib->{'debug_recursive'} = 1; $mib->{'debug_lexer'} = 0; $mib->{'make_dump'} = 1; $mib->{'use_dump'} = 1; $mib->{'do_imports'} = 1; $mib->{'allow_underscore'} = 1; $mib->load($file) || $mib->compile($file);
It works fine on Solaris using around 6 meg of memory to compile a MIB, but runs out of memory on Windows using around 1 GB (Yes I said GB). Is it apparent to anyone why this is the case? I've changed some of the flags for the compiler without success

any help would be greatly appreciated.

Replies are listed 'Best First'.
Re: Performance issues
by ibanix (Hermit) on Jul 02, 2003 at 20:22 UTC
    Well, I don't really understand what you're trying to do, but I'll take some wild guesses :-)

    Is there something in SNMP::MIB::Compiler that is written with a Unix-like OS in mind? Perhaps on Windows you hit a loop somewhere that never exits -- memory leak!

    (standard questions)
    Have you tried something simple with this module on Windows? Or adding debug output?

    Hope this helps,
    ibanix

    $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
Re: Performance issues
by BrowserUk (Patriarch) on Jul 02, 2003 at 23:06 UTC

    I can confirm that using your code exactly as posted, I can compile RFC1213-MIB from the test suite under v5.8/NT4 and perls memory usage never (quite) reaches 6MB, so it looks like a local problem on you Win32 box rather than an inherent problem with either the module or the OS.

    Suggestions: Try the same test I did, if that fails it's probably your installation of SNMP::NIB::Compile so blow it away and re-install, though as it's a stand-alone, pure perl module it difficult to see how that could be wrong.

    If the testcase works, then look closely at the file(s) your compiling. Are they really the sam eas those on you Solaris box? Do you have any circular dependancies?


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Re: Performance issues
by waswas-fng (Curate) on Jul 02, 2003 at 20:19 UTC
    Are you sure that Res memory in solaris is 6mb and there is not paged memory? for instance in solaris you may see RES at 6 mb and SIZE at 800 mb, look at top for those columns or if you dont have top: /usr/ucb/ps -aux will show you SZ and RSS columns

    -Waswas