in reply to Is (DOS-)Perl a Memory Hog?

If Perl is using up all of my extended memory, is there any way of telling it not to be so greedy?

No and yes. Perl does use a lot of memory as it has made the design compromise to spend memory and gain speed. However Perl uses precicely as much memory as you ask it to. If you post your code it may well be simple to optimise it to use less memory.

Also by DOS you really mean DOS or do you mean the DOS window you can get from Windows? Do you really only have 40MB? How much memory does your DOS based program use running all by its lonesome? Perl will 'typically' use circa 2-5MB for fairly trivial stuff and ramps up from there. If your DOS process needs almost all the memory you have you may be flat out of luck.

cheers

tachyon

Replies are listed 'Best First'.
Re: Re: Is (DOS-)Perl a Memory Hog?
by Neuroactive (Acolyte) on May 11, 2004 at 00:59 UTC
    Yes, I really mean MS-DOS not operating within Windows.

    This computer, with its meager 40MB, is set up for running custom psychophysiology software under DOS, so that it can assume complete control over the processor (for timing-critical stimulus/monitoring control). How much memory it uses depends on the particular experiment programmed and what images and sounds it preloads. I'm sure it can get by sharing with Perl, if Perl will share with it.

    My script for trying to run the other program is this:
    #!/perl/bin/perl -w
    use strict;
    my @args = ("STIM2", "/SESSION=none", "/ORDER=bx-err1", "/WARN=1");
    system (@args) == 0
    or die "System call failed: $?";

    But the script I used to check Perl's memory hogging (where it showed all extended memory was used up) was this:
    #!/perl/bin/perl -w
    use strict;
    system ("MEM") == 0
    or die "System call failed: $?";

    If there's a way of telling Perl to only take what it needs, I'd love to know. Thanks.

      I'm going to hell for saying this, but your first Perl script would be better written as a DOS batch file, which reduces the memory requirements to almost nothing.

        I give up. Although it would have been more elegant doing everything in Perl, since I don't have the expertise to recompile Perl for MS-DOS (or whatever might solve the problem), I'll resort to using batch files.

        (I guess I'll be seeing you in hell.) :-)

        Thanks for the good intentions.

      Just write a DOS batch file

      rem start.bat, save in path then just type start @echo off stim2 /session=none /order=bx-err1 /warn=1

      Command line args can be passed and appear in %1, %2, %3 etc like $ARGV[0], $ARGV[1], $ARGV[2].....

      See This batch file tutorial

      cheers

      tachyon