https://github.com/hitthecodelabs/memory-usage-profiler
Python script designed for monitoring the sizes of variables in memory
https://github.com/hitthecodelabs/memory-usage-profiler
memory memory-management python script
Last synced: 10 months ago
JSON representation
Python script designed for monitoring the sizes of variables in memory
- Host: GitHub
- URL: https://github.com/hitthecodelabs/memory-usage-profiler
- Owner: hitthecodelabs
- License: mit
- Created: 2023-11-25T06:54:04.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-25T07:03:00.000Z (about 2 years ago)
- Last Synced: 2025-02-04T11:43:56.824Z (12 months ago)
- Topics: memory, memory-management, python, script
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Memory-Usage-Profiler
This repository contains a Python script designed for monitoring the sizes of variables in memory, especially tailored for environments like Google Colab or Jupyter Notebooks.
## Overview
The script provides functions to list variables along with their memory sizes in a human-readable format. This can be particularly useful in data-intensive environments where efficient memory management is crucial.
## Features
- **Human-Readable Format**: Converts byte sizes into a more readable format (e.g., KB, MB).
- **Size Calculation**: Calculates the size of variables, including nested structures like lists, dictionaries, and custom objects.
- **Top N Variables**: Lists the top N variables consuming the most memory.
- **Pandas DataFrame Output**: Displays the results in a structured and readable table using Pandas DataFrame.
## Usage
To use the script, simply import it into your Python environment and call the `list_variables_size` function.
```python
import memory_monitor
# List top 10 variables by size
memory_monitor.list_variables_size()
```
You can adjust the number of variables displayed by passing a different number to the function.
## Requirements
- Python 3.x
- Pandas
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.