Profile and optimize Python memory usage with practical techniques.
Optimize memory usage for: [DESCRIBE YOUR APPLICATION] Current issues: - Memory usage: [OBSERVED USAGE] - Problem areas: [SUSPECTED BOTTLENECKS] - Data size: [TYPICAL DATA SIZE] Provide: 1. Memory profiling with memory_profiler 2. tracemalloc for allocation tracking 3. objgraph for object analysis 4. sys.getsizeof usage 5. Identifying memory leaks 6. Generator vs list optimization 7. __slots__ for class optimization 8. Weak references 9. NumPy memory views 10. Garbage collection tuning 11. Memory-mapped files 12. Optimization techniques 13. Before/after benchmarks
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[DESCRIBE YOUR APPLICATION][OBSERVED USAGE][SUSPECTED BOTTLENECKS][TYPICAL DATA SIZE]