• Study Materials – Company wise
    • Infosys Archive
    • Accenture Archive
    • AMCAT Archive
    • Capgemini Archive
    • Cisco Archive
    • CoCubes Archive
    • Cognizant(CTS) Archive
    • Dell Archive
    • Deloitte Archive
    • DXC Archive
    • Goldman Sachs Archive
    • Hexaware Technologies Archive
    • LTI Archive
    • MindTree Archive
    • TCS Archive
    • Virtusa Archive
    • Wipro Archive
  • Interview Preparation – E Books
    • C Interview Questions
    • Data Structures Interview Questions
    • DBMS Interview Questions
    • HR Interview Questions
    • Java Interview Questions
    • Operating System Interview Questions
    • Python Interview Questions
    • SQL Query Interview Questions
  • Programming
    • C Programming MCQs
    • C Code Snippets – Output Questions
    • Python Code Snippets – Output Questions
  • Aptitude
    • Verbal Ability for Placements
    • Quant for Placements
  • Register
  • Login
CODE OF GEEKS

We at CODE OF GEEKS, aim at providing best and quality content for our users at no extra cost.

    • Study Materials – Company wise
      • Infosys Archive
      • Accenture Archive
      • AMCAT Archive
      • Capgemini Archive
      • Cisco Archive
      • CoCubes Archive
      • Cognizant(CTS) Archive
      • Dell Archive
      • Deloitte Archive
      • DXC Archive
      • Goldman Sachs Archive
      • Hexaware Technologies Archive
      • LTI Archive
      • MindTree Archive
      • TCS Archive
      • Virtusa Archive
      • Wipro Archive
    • Interview Preparation – E Books
      • C Interview Questions
      • Data Structures Interview Questions
      • DBMS Interview Questions
      • HR Interview Questions
      • Java Interview Questions
      • Operating System Interview Questions
      • Python Interview Questions
      • SQL Query Interview Questions
    • Programming
      • C Programming MCQs
      • C Code Snippets – Output Questions
      • Python Code Snippets – Output Questions
    • Aptitude
      • Verbal Ability for Placements
      • Quant for Placements
    • Register
    • Login
  • [email protected]
  • ..
Login / Register
Apply Now
CODE OF GEEKS
CODE OF GEEKS
  • Study Materials – Company wise
    • Infosys Archive
    • Accenture Archive
    • AMCAT Archive
    • Capgemini Archive
    • Cisco Archive
    • CoCubes Archive
    • Cognizant(CTS) Archive
    • Dell Archive
    • Deloitte Archive
    • DXC Archive
    • Goldman Sachs Archive
    • Hexaware Technologies Archive
    • LTI Archive
    • MindTree Archive
    • TCS Archive
    • Virtusa Archive
    • Wipro Archive
  • Interview Preparation – E Books
    • C Interview Questions
    • Data Structures Interview Questions
    • DBMS Interview Questions
    • HR Interview Questions
    • Java Interview Questions
    • Operating System Interview Questions
    • Python Interview Questions
    • SQL Query Interview Questions
  • Programming
    • C Programming MCQs
    • C Code Snippets – Output Questions
    • Python Code Snippets – Output Questions
  • Aptitude
    • Verbal Ability for Placements
    • Quant for Placements
  • Register
  • Login
0

Cart

Variables & Garbage Collection in Python

  • January 17, 2020
  • CODE OF GEEKS
  • 0


Like any other programming language, concept of variable is connected to memory allocation. Variable is the storage space which can store the values, as per its behavior.

For instance, let us consider a statement, a = 20, here memory is allocated with name ‘a’ and value 20 is stored in it. In the similar manner, for every variable, a separate memory space is allocated in the heap memory area.

Do you know ?

Python Programming follows the approach of Duck Typing.

Using Duck Typing, we do not check types at all, we check for the presence of a given method or attribute.
The name Duck Typing comes from the phrase:
“If it looks like a duck and quacks like a duck, it’s a duck.”

Garbage Collection

Garbage Collection is a form of automatic memory management. The garbage collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program. Module that represents the garbage collector is named as ‘gc‘. Garbage collector aims to identify the reference cycles. Reference cycle is the cycle of references from initial object to final object. It is used to identify reference count of any object. When any object is referenced, its reference count is set to 1. Garbage collector will only remove the objects if its reference count is 0.

Garbage collector runs automatically. Python schedules the garbage collector on the basis of threshold value. It can be known with the help of get_threshold() of gc module. However, in some cases, where reference cycle is not found, it is suggested to run gc manually using collect() method.

That’s all, see you in the next lecture.





Tags: garbage collection in pythonpython garbage collectionvariables in python
  • Previous Datatypes in Python
  • Next Comments in Python

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Table of Content – Python

  1. Introduction to Python Programming
    • Python and its features
    • Key Differences : C vs Python
    • Key Differences : Java vs Python
    • Python Flavors
    • PVM and Memory Management in Python

  2. Python Programming Fundamentals
    • 'Hello World' using Python
    • Comments in Python
    • Variables and Garbage Collection in Python
    • Datatypes in Python
    • Determining the Datatype of Literal | type() method
    • Tokens in Python
    • Keywords in Python
    • Identifiers and Naming Convention in Python
    • Literals in Python

  3. Python Operators
    • Operators in Python
    • Python Mathematical Functions

  4. Python User Inputs
    • Taking Inputs | input() function in Python

  5. Python Control Statements
    • Control Statements in Python
    • If-elif-else Statements in Python
    • Looping in Python
    • while loop in Python
    • for loop in Python
    • Infinite loops in Python
    • Nested loops in Python
    • Break Statement in Python
    • Continue Statement in Python
CODE OF GEEKS

Subscribe to Newsletter

CODE OF GEEKS

Learn | Code | Achieve

Reach us

[email protected]
We at CODE OF GEEKS, aim at providing quality content to our users at no cost.
CODE OF GEEKS

Important Pages

About us
Advertise
Privacy Policy
Terms and Conditions

Placements – Study Materials

TCS NQT     Wipro     CapGemini
Accenture     MindTree     CTS
DXC     Hexaware Technologies     AMCAT
CoCubes     Goldman Sachs     Dell
Cisco     Deloitte     Virtusa     LTI     Infosys   

Courses

  • Mail Us
  • Login/Register

Recent Posts

What is Cloud Computing | Cloud Computing Applications | Cloud Development Models| SaaS vs PaaS vs IaaS
  • October 23, 2021
What is Amazon Web Services | AWS Regions & AZs | Different AWS Services
  • October 19, 2021

Copyright 2021 CODE OF GEEKS. All Rights Reserved.

  • →