h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
564 stars 85 forks source link

[bug] computer memory leak #126

Closed LY1806620741 closed 10 months ago

LY1806620741 commented 1 year ago

info

VScode Env

版本: 1.79.0 (user setup) 提交: b380da4ef1ee00e224a15c1d4d9793e27c2b6302 日期: 2023-06-07T14:26:35.552Z Electron: 22.5.5 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.17763 plugin: Jupyter v2023.5.1001582324

python

python version: 3.11.2

case

aurora.json size: 1.33MB, Only data features are provided because of sensitive dat

{
   "data":[{
        "test":"test"
        ... otherKey
    },{
        "test":"test"
    }...x87]
}
import json

js=None
with open("./data/aurora.json",encoding="utf8") as j:
    js=json.loads(j.read())
from jsonpath_ng import jsonpath, parse

jsonpath_expression = parse('$.data[*].test')
match = jsonpath_expression.find(js)

print(match)

then It use all my computer memory and unresponsive. 11G/15G before running print, and the remaining 4G memory is fully occupied after running.

michaelmior commented 12 months ago

@LY1806620741 Could you provide an example JSON file that exhibits this problem? I understand your specific data file is sensitive, but perhaps you could scrub the sensitive information first. It would be much easier to fix with a reproducible example of the problem.

michaelmior commented 10 months ago

Closing since there hasn't been any update, but feel free to reopen if you can provide an example data file that reproduces the problem.