Skip to content

windows10 python3.7 解析hprof文件好像递归溢出了,测试了别的小一些的hrpof没有问题,看下能否兼容下这种情况呢 #8

Closed

Description

@mr-torto

--- Analyzing HPROF file: xxx.hprof ---
HPROF版本: JAVA PROFILE 1.0.3
标识符大小: 4
时间戳: 2026-02-10 17:07:35.558000
正在解析HPROF记录...
正在检测 App 包名...
检测到 App 包名: xxx
正在构建引用图...
正在计算支配树和Retained Size...
解析HPROF文件失败: maximum recursion depth exceeded in comparison
Traceback (most recent call last):
File ".\tools\hprof_parser.py", line 216, in parse
self.calculate_retained_sizes()
File ".\tools\hprof_parser.py", line 916, in calculate_retained_sizes
compute_retained(obj_id)
File ".\tools\hprof_parser.py", line 908, in compute_retained
retained += compute_retained(dominated_id)
File ".\tools\hprof_parser.py", line 908, in compute_retained
retained += compute_retained(dominated_id)
File ".\tools\hprof_parser.py", line 908, in compute_retained
retained += compute_retained(dominated_id)
[Previous line repeated 991 more times]
File ".\tools\hprof_parser.py", line 904, in compute_retained
retained = self.shallow_sizes.get(obj_id, 0)
RecursionError: maximum recursion depth exceeded in comparison

--- Analysis complete. ---

Activity

  1. Gracker commented on Feb 11, 2026

    @Gracker
    Owner

    使用最新的试试

  2. mr-torto commented on Feb 11, 2026

    @mr-torto
    Author

    没明白,这个日志能看到工具的版本吗,我看没有别的分支了,直接刚下载的最新的尝试的。
    我看analyze.py ‎修改时间:2026‎年‎2‎月‎10‎日,‏‎15:30:01

  3. Gracker commented on Jul 22, 2026

    @Gracker
    Owner

    已确认这个递归溢出在 368a838 中通过迭代式 retained-size 后序遍历修复;#9(merge commit af8a6ec)又加入了一个超过 Python recursion limit 的 dominator 深链回归测试,当前不会再通过递归计算 retained size。

    验证:./scripts/verify.sh 本地 57 项通过;GitHub Actions 的 Python 3.8、3.12 与 public-install 全部通过。

    当前 README 明确要求 Python 3.8+,因此 Python 3.7 不再是受支持运行时。若在 Python 3.8+、当前 master 上对同一 HPROF 仍出现 maximum recursion depth exceeded,请重新打开并附上 git rev-parse HEAD、完整 traceback 和可脱敏的 HPROF 结构信息。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions