MemoryManager class

Memory management utility for the CustomFit SDK

Properties

canCleanup bool
Whether this component can be safely cleaned up Critical components might return false
no setter
componentName String
Human-readable name for logging and debugging
no setter
estimatedMemoryUsage int
Estimated memory usage in bytes Return -1 if unknown
no setter
hashCode int
The hash code for this object.
no setterinherited
memoryPriority int
Priority of this component (higher values = higher priority) Higher priority components are cleaned up last Range: 0-100, where 100 is critical system component
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onMemoryPressure(MemoryPressureLevel level) Future<void>
Called when memory pressure changes Components should implement cleanup strategies based on the pressure level
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance MemoryManager
no setter

Static Methods

checkForLeaks() List<String>
Check for potential memory leaks
clearWeakReferences() → void
Clear all weak references
createWeakCache<T extends Object>([int maxSize = 100]) WeakCache<T>
Create a weak cache for temporary storage
disableAdaptiveCleanup() → void
Disable adaptive cleanup
enableAdaptiveCleanup() → void
Enable adaptive cleanup based on memory pressure
forceCleanup() → void
Force garbage collection and cleanup
getMemoryStats() Map<String, dynamic>
Get current memory statistics
initialize() → void
Initialize the memory manager
optimizeComponent(String category) → void
Optimize memory usage for a specific component
performAdaptiveCleanup({bool aggressive = false}) → void
Perform adaptive cleanup based on pressure level Called by MemoryCoordinator
shutdown() → void
Shutdown the memory manager
trackObject(Object object, [String? category]) → void
Track an object for memory management