Skip to content

Python script designed for monitoring the sizes of variables in memory

License

Notifications You must be signed in to change notification settings

hitthecodelabs/Memory-Usage-Profiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

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.

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 file for details.

About

Python script designed for monitoring the sizes of variables in memory

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages