talk2me/static/js/src
Adolfo Delorenzo 1b9ad03400 Fix potential memory leaks in audio handling - Can crash server after extended use
This comprehensive fix addresses memory leaks in both backend and frontend that could cause server crashes after extended use.

Backend fixes:
- MemoryManager class monitors process and GPU memory usage
- Automatic cleanup when thresholds exceeded (4GB process, 2GB GPU)
- Whisper model reloading to clear GPU memory fragmentation
- Aggressive temporary file cleanup based on age
- Context manager for audio processing with guaranteed cleanup
- Integration with session manager for resource tracking
- Background monitoring thread runs every 30 seconds

Frontend fixes:
- MemoryManager singleton tracks all browser resources
- SafeMediaRecorder wrapper ensures stream cleanup
- AudioBlobHandler manages blob lifecycle and object URLs
- Automatic cleanup of closed AudioContexts
- Proper MediaStream track stopping
- Periodic cleanup of orphaned resources
- Cleanup on page unload

Admin features:
- GET /admin/memory - View memory statistics
- POST /admin/memory/cleanup - Trigger manual cleanup
- Real-time metrics including GPU usage and temp files
- Model reload tracking

Key improvements:
- AudioContext properly closed after use
- Object URLs revoked after use
- MediaRecorder streams properly stopped
- Audio chunks cleared after processing
- GPU cache cleared after each transcription
- Temp files tracked and cleaned aggressively

This prevents the gradual memory increase that could lead to out-of-memory errors or performance degradation after hours of use.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-03 08:37:13 -06:00
..
apiClient.ts Implement proper CORS configuration for secure cross-origin usage 2025-06-02 23:51:27 -06:00
app.ts Fix potential memory leaks in audio handling - Can crash server after extended use 2025-06-03 08:37:13 -06:00
connectionManager.ts Add connection retry logic to handle network interruptions gracefully 2025-06-03 00:00:03 -06:00
connectionUI.ts Add connection retry logic to handle network interruptions gracefully 2025-06-03 00:00:03 -06:00
errorBoundary.ts Implement proper error boundaries to prevent app crashes 2025-06-02 22:47:43 -06:00
memoryManager.ts Fix potential memory leaks in audio handling - Can crash server after extended use 2025-06-03 08:37:13 -06:00
performanceMonitor.ts Implement streaming translation for 60-80% perceived latency reduction 2025-06-02 23:10:58 -06:00
requestQueue.ts Add connection retry logic to handle network interruptions gracefully 2025-06-03 00:00:03 -06:00
speakerManager.ts Add multi-speaker support for group conversations 2025-06-02 23:39:15 -06:00
streamingTranslation.ts Implement streaming translation for 60-80% perceived latency reduction 2025-06-02 23:10:58 -06:00
translationCache.ts Add comprehensive input validation and sanitization 2025-06-02 22:58:17 -06:00
types.ts Add health check endpoints and automatic language detection 2025-06-02 22:37:38 -06:00
validator.ts Add comprehensive input validation and sanitization 2025-06-02 22:58:17 -06:00