Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Memory management

by CountZero (Bishop)
on Aug 12, 2009 at 05:53 UTC ( [id://787840]=note: print w/replies, xml ) Need Help??


in reply to Memory management

I thought Perl was a language where you didn't have to bother yourself with such low-level matters as "memory management".

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: Memory management
by abubacker (Pilgrim) on Aug 12, 2009 at 06:10 UTC

    Yes you are correct ,
    but when I am going to develop a new and small OS based on the linux kernel I have to take care all the low level parameters ,
    so please help me out !

      Then Perl is too high level to deal with such details.

      I'd recommend you read a good book on operating system design, I've heard that "Modern Operating Systems" by Tannenbaum should be quite good (though never read it myself).

        Of course, reading Tanenbaum and then trying to use Linux is not necessarily for everybody :). But having a general grasp of operating systems is recommendable and I assume that Tanenbaum knows how to teach the basics of operating systems in general and the specifics of a good operating system as well.

      The Perl memory management model is both simple and high performance.

      If you watch the memory "footprint" of a long lived Perl process, you will observe that it grows and never gets smaller. Once Perl has a hunk of memory from the OS, it will never give it back to the OS although Perl will reuse that memory for its own purposes. So a Perl process approaches a maximum size as it runs.

      It is possible nowadays to run Perl even on a small embedded system. JAVA or C# have much more complex memory models as well as complex, hard to understand performance "hits".

      Perl may or may not be a good implementation language for your system. More and more systems are built with a mixture of languages. Perl is THE "black belt" at processing text. Last year I talked with some folks who write automated commodity trading software. These guys are like 300 feet via fiber optic cable from the exchange - it doesn't get closer than that. What do these guys use to handle the text data? You got it, Perl! What do they use to drive the "middle ware"? You got it, 'C'.

        Can't say i've noticed any of my scripts memory usage growing over time, (over a few days anyway.) But then again, windows is a complete liar sometimes with regards to memory usage.

        I'm just curious, do you have an example script that produces this behaviour?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://787840]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-03-29 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found