Python: Memory Management
Modules & Packages
Sacha Knowledge Exchange Session
Topic
Vijayalakshmi
kvijay62@ford.com
0.What is Memory management?
1. Memory allocation in python
- Stack
- Heap
Efficient Resource Handling in Python
Python's Memory Manager
Garbage Collector
(Python objects &
data structure)
Memory Manager
Python Program
Interpreter
Private Heap Space
Reference Counting
refcount = 1
refcount = 2
refcount = 3
Garbage Collection (GC)
Modules: gc, sys, tracemalloc.
gc module: Provides control over garbage collection.sys module: Allows for interrogation of memory usage.tracemalloc module: Tracks memory allocations for detecting leaks.Global Interpreter Lock (GIL)
How it Works?
- Single Thread Execution
- Switching Between Threads
What?
What is Modules?
Importing Modules
Standard Library
How to create Own Modules?
What is packages?
Build your own package
Any Queries?