Memory: measuring 5 limitations

Discussion in 'Perl Misc' started by Bart Van der Donck, Dec 10, 2003.

  1. Hello,

    My hosting provider uses these limitations for perl programs:

    Size of Core Files - 0 MB
    CPU Time Used - 30 seconds
    Memory Size - 16 MB
    Number of Open Files - 32
    Number of Simultaneous Processes - 8

    Now I am gonna make a more advanced perl script and I want to make
    sure that it will be OK with these requirements. I am looking for a
    way to easily display these things for my script. The script will get
    data out of a db table (prices) and then calculate them according to
    valuta, rate, markup dealers, etc. and then it starts comparing each
    one to get the cheapest. I believe it will use heavy memory, because
    it is about a lot of prices.

    I did some research at Perldoc and Google.

    /usr/bin/top: no permission (can't change that)

    Use of perl's $ENV{PERL_DEBUG_MSTATS}: unknown $ENV variable (can't
    change that either)

    `` use Devel::peek; mstat(); ´´
    Devel::peek = ok
    but mstat() apparantly requires that perl was built in a non-standard
    way. I can't change this either.

    Then I try to call perl with the -dl flag: this seems to work.
    And then I write
    `` do 'lib/auto/POSIX/autosplit.ix'; ´´
    But then I come in some kind of other shell I think... Toink :)
    I played around with it, but all seems very complex. Moreover I get
    the impression that it is only about the memory size (=the 16 MB that
    is maximum) and not about the other limits.

    Quotation from
    http://www.perldoc.com/perl5.8.0/pod/perldebguts.html:
    "
    There are two Perl-specific ways to analyze memory usage:
    $ENV{PERL_DEBUG_MSTATS} and -DL command-line switch. The first is
    available only if Perl is compiled with Perl's malloc(); the second
    only if Perl was built with -DDEBUGGING. See the instructions for how
    to do this in the INSTALL podpage at the top level of the Perl source
    tree.
    "

    So, 1 basic question: is there a command like:
    `` memory myscript.pl ´´
    that would display the memory of my script?

    I don't want to code an entire program and then find out that I can't
    use it because of memory restrictions.

    Thanks,
    Bart
    Bart Van der Donck, Dec 10, 2003
    #1
    1. Advertising

  2. It was a dark and stormy night, and Bart Van der Donck managed to scribble:

    > Hello,
    >
    > My hosting provider uses these limitations for perl programs:
    >
    > Size of Core Files - 0 MB
    > CPU Time Used - 30 seconds
    > Memory Size - 16 MB
    > Number of Open Files - 32
    > Number of Simultaneous Processes - 8
    >


    Do like I did - change ISPs - and look at www.linode.com or other UML linux provider

    gtoomey
    Gregory Toomey, Dec 10, 2003
    #2
    1. Advertising

  3. On 10 Dec 2003 01:24:14 -0800
    (Bart Van der Donck) wrote:
    > So, 1 basic question: is there a command like:
    > `` memory myscript.pl ´´
    > that would display the memory of my script?
    >
    > I don't want to code an entire program and then find out that I
    > can't use it because of memory restrictions.


    *If* you have shell access, you *may* be able to use
    'time "name of script here"'.
    This will give you information about the execution of the script. Not
    Perl, but it will give you more information than what you're getting
    now.

    If you wanted to do it in Perl, best start with a simple
    'perl -V'
    at the command line to see what your host has. Some of the neat
    debugging stuff you may not be able to do with you host's build of
    Perl. In fact, if theu use a canned distro of Linux, *most* distros
    don't build Perl with debugging enabled. Why? I don't know.

    As a last resort, look for another host :)

    Just my $0.02

    --
    Jim

    Copyright notice: all code written by the author in this post is
    released under the GPL. http://www.gnu.org/licenses/gpl.txt
    for more information.

    a fortune quote ...
    Gnagloot, n.: A person who leaves all his ski passes on his
    <jacket just to impress people. -- Rich Hall, "Sniglets"
    James Willmore, Dec 10, 2003
    #3
  4. James Willmore wrote:

    > *If* you have shell access, you *may* be able to use
    > 'time "name of script here"'.
    > This will give you information about the execution of the script. Not
    > Perl, but it will give you more information than what you're getting
    > now.


    Yeah I have shell access and I can execute the time command.

    The output of 'time "script.cgi"' is:
    script.cgi: command not found

    So I played a little around, my best shot was something like this:
    'time "perl -e script.cgi"'
    But whatever I do, it always says that it can't find the command
    between the quotation marks.

    However the output format looks great and I believe that it is what I
    need:
    0.000u 0.000s 0:00.00 0.0% 0+0k 0+0io 0pf+0w
    Am I missing something?

    Regards
    Bart
    Bart Van der Donck, Dec 11, 2003
    #4
  5. Bart Van der Donck

    Malte Ubl Guest

    > 'time "perl -e script.cgi"'

    time perl script.cgi

    ???
    Malte Ubl, Dec 11, 2003
    #5
  6. On 11 Dec 2003 02:44:38 -0800
    (Bart Van der Donck) wrote:
    > James Willmore wrote:
    >
    > > *If* you have shell access, you *may* be able to use
    > > 'time "name of script here"'.
    > > This will give you information about the execution of the script.
    > > Not Perl, but it will give you more information than what you're
    > > getting now.

    >
    > Yeah I have shell access and I can execute the time command.
    >
    > The output of 'time "script.cgi"' is:
    > script.cgi: command not found


    [Sigh}

    I hate trying to type in what a command should look like - because it
    always seems to be mis-interpreted.

    You don't need the double quotes around the command you're trying to
    execute. For example:

    jim@maxine:~> time ls
    [lots of output from the ls command]

    real 0m0.564s
    user 0m0.010s
    sys 0m0.000s
    jim@maxine:~>

    If you can execute your script *without* typing in perl at the
    beginning, then you have a script that can be executed. If not, then
    you have your permissions set wrong - which looks like the case here.

    > However the output format looks great and I believe that it is what
    > I need:
    > 0.000u 0.000s 0:00.00 0.0% 0+0k 0+0io 0pf+0w
    > Am I missing something?


    I haven't seen output like that from 'time' before. At least, not on
    a Linux system. What OS is your host using?

    The "workaround" I gave was for a *INX system - I should have been
    specific about that. Sorry :-(

    I'm thinking you may want to contact your host to see what solutions
    they may have. We're starting to get away from Perl on this issue.

    Last resort - shop around for a host that has the functionality you're
    looking for - and read up a little more on using Perl through CGI.
    Google is an excellent place to start - because there have been *many*
    questions asked about using Perl through CGI asked and answered in
    this and other newsgroups.

    HTH

    --
    Jim

    Copyright notice: all code written by the author in this post is
    released under the GPL. http://www.gnu.org/licenses/gpl.txt
    for more information.

    a fortune quote ...
    You should emulate your heros, but don't carry it too far.
    Especially if they are dead.
    James Willmore, Dec 11, 2003
    #6
  7. Oops! What a blunder about the quotes. I thought it were only the
    single quotes. Yes it seems to work now with this command:

    me@myserver% time perl myscript.pl
    0.113u 0.034s 0:00.17 82.3% 918+2014k 0+0io 0pf+0w
    me@myserver%

    I will study the docs to find out what this output exactly means.

    Thanks again,
    Bart

    PS: I also tried:
    ``time "\/path\/to\/perl" -e -"[options]" '/path/to/"myscript\.pl"'´´
    but that didn't work.
    (joke :))
    Bart Van der Donck, Dec 12, 2003
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guadala Harry

    Measuring Memory Useage

    Guadala Harry, Oct 25, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    434
    bruce barker
    Oct 25, 2004
  2. Katerina MacLean

    Measuring Memory Usgae

    Katerina MacLean, Aug 29, 2004, in forum: Java
    Replies:
    0
    Views:
    417
    Katerina MacLean
    Aug 29, 2004
  3. Replies:
    0
    Views:
    435
  4. Chris Hamel

    Memory Limitations for Perl Programs?

    Chris Hamel, Sep 5, 2006, in forum: Perl Misc
    Replies:
    6
    Views:
    129
    Steven N. Hirsch
    Sep 8, 2006
  5. MC

    Javascript Memory Limitations

    MC, Aug 14, 2010, in forum: Javascript
    Replies:
    16
    Views:
    1,222
    Evertjan.
    Aug 21, 2010
Loading...

Share This Page