要求用 C 编写内存分析工具:附加进程、追踪堆分配、带栈回溯的泄漏检测并生成报告。
用 C 语言开发一个内存分析工具,用于分析进程的内存使用情况。实现对进程的附加功能,且性能影响最小。添加堆分析功能,支持内存分配追踪。包含内存泄漏检测功能,并附带栈回溯信息。实现内存使用情况的可视化,并提供详细统计信息。添加自定义分配器钩子(custom allocator hooking),以实现更精细的追踪。包含以多种格式生成报告的功能。实现过滤选项,以降低噪声干扰。添加快照间对比功能。包含命令行接口,并支持交互模式。实现信号处理机制,以确保干净地脱离目标进程。
Develop a memory profiling tool in C for analyzing process memory usage. Implement process attachment with minimal performance impact. Add heap analysis with allocation tracking. Include memory leak detection with stack traces. Implement memory usage visualization with detailed statistics. Add custom allocator hooking for detailed tracking. Include report generation in multiple formats. Implement filtering options for noise reduction. Add comparison functionality between snapshots. Include command-line interface with interactive mode. Implement signal handling for clean detachment.