Performance of Python Programming

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • psbasha
    Contributor
    • Feb 2007
    • 440

    #1

    Performance of Python Programming

    Hi,

    Since in other languages we have pointer concept and we allocate memory and deallocate memory for various variables .So there will not be much memory consumption.But in case of Python we dont have memory allocation concept to variables,then what will be the memory consumption and performance of the applications developed.


    Thanks in advance
    PSB
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by psbasha
    Hi,

    Since in other languages we have pointer concept and we allocate memory and deallocate memory for various variables .So there will not be much memory consumption.But in case of Python we dont have memory allocation concept to variables,then what will be the memory consumption and performance of the applications developed.


    Thanks in advance
    PSB
    High level languages such as Java and Python use a thing called garbage collecting (gc). What the engine does is count the number of references to a variable. When that count reaches zero, the varable is marked for gc. Every so often the engine goes through and frees memory use by variable that no are longer being used.
    You can use
    Code:
    del anyVariable
    to free memory imediately (often used for large variables that are no longer needed).

    Comment

    • ghostdog74
      Recognized Expert Contributor
      • Apr 2006
      • 511

      #3
      Originally posted by bartonc
      You can use
      Code:
      del anyVariable
      to free memory imediately...
      actually del just removes the name from the namespace. see here . The memory is not reclaimed until later. ( not sure for latest version of Python though)

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by ghostdog74
        actually del just removes the name from the namespace. see here . The memory is not reclaimed until later. ( not sure for latest version of Python though)
        Thanks for the correction. Glad to see that you have become a very active and (always) valuable part of this community. Thanks for all your input.

        Comment

        • ghostdog74
          Recognized Expert Contributor
          • Apr 2006
          • 511

          #5
          Originally posted by bartonc
          Thanks for the correction. Glad to see that you have become a very active and (always) valuable part of this community. Thanks for all your input.
          No prob. glad to be part of the community too

          Comment

          Working...