Skip to content

Latest commit

 

History

History
85 lines (62 loc) · 1.36 KB

File metadata and controls

85 lines (62 loc) · 1.36 KB

Quick Start Guide

Installation

From PyPI (when published)

pip install memoryguard

From Source

git clone https://github.com/YOUR_USERNAME/memoryguard.git
cd memoryguard
pip install -e .

Development Mode

git clone https://github.com/YOUR_USERNAME/memoryguard.git
cd memoryguard
make install-dev

Usage Examples

1. Basic Monitoring

from memoryguard import MemoryGuard

guard = MemoryGuard()
alert = guard.check_memory("my_operation")

if alert:
    print(f"Memory alert: {alert.message}")

2. Function Tracking

from memoryguard import track_memory

guard = MemoryGuard()

@track_memory("heavy_function", guard)
def heavy_function():
    return sum(i**2 for i in range(1000000))

result = heavy_function()

3. Context Manager

from memoryguard import memory_context

with memory_context("database_query", guard):
    data = fetch_large_dataset()
    process(data)

4. Live Dashboard

from memoryguard import MemoryDashboard

dashboard = MemoryDashboard(guard)

with dashboard.live_display():
    run_long_operation()

Running Tests

make test

Running Demo

make demo

Next Steps