UNPKG

facezk-core

Version:

ZKP-AI Proof of Humanity: Live Selfie Check with Biometric Template Extraction and Fuzzy Hashing

108 lines 2.67 kB
/** * Memory Management Plugin * Handles TensorFlow.js memory allocation, cleanup, and monitoring */ import * as tf from '@tensorflow/tfjs-core'; import type { IMemoryPlugin, MemoryStats, PluginState } from '../core/interfaces'; export interface MemoryPluginConfig { maxMemoryMB: number; cleanupThreshold: number; cleanupInterval: number; enableMonitoring: boolean; enableProfiling: boolean; tensorTracking: boolean; } export declare class MemoryPlugin implements IMemoryPlugin { readonly id = "memory-plugin"; readonly name = "Memory Management Plugin"; readonly version = "2.0.0"; state: PluginState; private config; private cleanupTimer; private monitoringTimer; private tensorRegistry; private memoryHistory; private peakMemory; private totalAllocated; private cleanupCount; constructor(config?: Partial<MemoryPluginConfig>); initialize(config?: Partial<MemoryPluginConfig>): Promise<void>; dispose(): Promise<void>; isReady(): boolean; /** * Allocate memory and track usage */ allocate(size: number): Promise<void>; /** * Perform memory cleanup */ cleanup(): Promise<void>; /** * Get current memory statistics */ getStats(): MemoryStats; /** * Start memory monitoring */ monitor(): void; /** * Stop memory monitoring */ stopMonitoring(): void; /** * Track a tensor for automatic cleanup */ trackTensor(tensor: tf.Tensor): void; /** * Untrack a tensor */ untrackTensor(tensor: tf.Tensor): void; /** * Get memory usage history */ getMemoryHistory(): MemoryStats[]; /** * Get peak memory usage */ getPeakMemory(): number; /** * Get cleanup statistics */ getCleanupStats(): { count: number; totalFreed: number; }; /** * Check if memory usage is above threshold */ isMemoryPressure(): boolean; /** * Get current memory statistics */ private getCurrentMemoryStats; /** * Start memory monitoring */ private startMonitoring; /** * Start cleanup timer */ private startCleanupTimer; /** * Stop cleanup timer */ private stopCleanupTimer; /** * Setup TensorFlow.js tensor tracking */ private setupTensorTracking; /** * Get plugin configuration */ getConfig(): Required<MemoryPluginConfig>; /** * Update plugin configuration */ updateConfig(newConfig: Partial<MemoryPluginConfig>): Promise<void>; } //# sourceMappingURL=memory-plugin.d.ts.map