/** * Memory profiling utilities for automated memory leak detection * * This utility can be used during development to detect memory leaks * without requiring manual browser testing. */ export interface MemorySample { timestamp: number; heapUsed: number; heapTotal: number; external: number; arrayBuffers: number; } export interface MemorySnapshot { samples: MemorySample[]; startTime: number; endTime: number; totalGrowth: number; averageGrowthPerSample: number; peakHeap: number; baselineHeap: number; } export declare class MemoryProfiler { private samples; private startTime; private isRunning; private intervalId; /** * Start collecting memory samples at the specified interval */ start(intervalMs?: number): void; /** * Stop collecting samples and return snapshot */ stop(): MemorySnapshot; /** * Take a memory sample */ private takeSample; /** * Get current memory info from browser */ private getMemoryInfo; /** * Create snapshot from collected samples */ private createSnapshot; /** * Get current statistics without stopping */ getStats(): MemorySnapshot; /** * Clear all collected samples */ clear(): void; /** * Format snapshot for logging */ static formatSnapshot(snapshot: MemorySnapshot): string; /** * Check if memory growth exceeds threshold */ static isLeaking(snapshot: MemorySnapshot, thresholdMB?: number): boolean; /** * Detect memory leak by comparing snapshots */ static compareSnapshots(before: MemorySnapshot, after: MemorySnapshot): { growth: number; growthPercent: number; isLeaking: boolean; }; } /** * Helper function to profile a specific operation */ export declare function profileOperation(operation: () => Promise, label?: string): Promise<{ result: T; snapshot: MemorySnapshot; }>; /** * Helper to profile multiple cycles of an operation */ export declare function profileCycles(operation: () => Promise, cycles?: number, label?: string): Promise<{ snapshots: MemorySnapshot[]; totalGrowth: number; averageGrowthPerCycle: number; isLeaking: boolean; }>; //# sourceMappingURL=memoryProfiler.d.ts.map