AOSSIE-Org / AOSSIE-Org/Ell-ena
BUG:[windows] Memory leak in WindowClassRegistrar singleton
- Langage dominant
- Dart
- Étoiles
- 54
- Forks
- 110
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### What happened?
**Issue Overview**
WindowClassRegistrar::GetInstance() uses new to allocate memory but never calls delete, causing a memory leak. The destructor is never invoked, and window class registration cleanup never occurs.
**File**: windows/runner/win32_window.cpp
**Steps to Reproduce**
1. Create a new Flutter Windows project
2. Build and run the application (debug or release mode)
3. Close the application
4. Monitor memory usage with tools like Dr Memory or Visual Studio Diagnostic Tools
**Expected Behavior**
No memory leak; all allocated resources are properly cleaned up when the application exits or when the window class is unregistered.
**Actual Behavior**
Memory allocated by `new WindowClassRegistrar()` persists after application shutdown. While the leak is small (one instance per process), it violates C++ best practices and can accumulate in long-running sessions.
**Root Cause**
cpp
static WindowClassRegistrar* GetInstance() {
if (!instance_) {
instance_ = new WindowClassRegistrar(); // BUG: Never deleted
}
return instance_;
}
### Record
- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.