benibela / xidel

Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
http://www.videlibri.de/xidel.html
GNU General Public License v3.0
674 stars 42 forks source link

Xidel 0.9.9 (20210529.7880.e0cb7e033b4b) head dump / memory leak (?) #70

Closed iegubkin closed 3 years ago

iegubkin commented 3 years ago

With fully updated Arch Linux and default kernel (5.12.9) earlier version of xidel works flawlessly:

$ xidel --version
Xidel 0.9.9
(20210309.7795.c4e17e2d216c)

$ xidel --data=ap.json --silent --extract='$json/cards/contents/headline'

US to swiftly boost global vaccine sharing, Biden announces
Trump's grip on GOP sparks fears about democratic process
No 'provoking': Israeli official vows quieter tone with US
Biden's pledge on media freedom may be easier said than done
...

However the latest release of xidel fails with the output:

$ xidel --version
Xidel 0.9.9
(20210529.7880.e0cb7e033b4b)

Heap dump by heaptrc unit of /usr/bin/xidel
2710 memory blocks allocated : 922108/924128
2710 memory blocks freed     : 922108/924128
0 unfreed memory blocks : 0
True heap size : 196608
True free heap : 196608

$ xidel --data=ap.json --silent --extract='$json/cards/contents/headline'
Error:
err:XPST0008: Unknown variable: $json
Heap dump by heaptrc unit of /usr/bin/xidel
2824 memory blocks allocated : 1536575/1538752
2809 memory blocks freed     : 927191/929352
15 unfreed memory blocks : 609384
True heap size : 1409024
True free heap : 796192
Should be : 796744
Call trace for block $00007FCFAA57ADE0 size 49
Call trace for block $00007FCFAA57ACC0 size 80
  $00000000004690EB
Call trace for block $00007FCFAA0AA110 size 608657
Call trace for block $00007FCFAA551300 size 32
Call trace for block $00007FCFAA550D00 size 24
Call trace for block $00007FCFAA550C00 size 24
Call trace for block $00007FCFAA550B00 size 24
Call trace for block $00007FCFAA543100 size 54
  $000000000046CFE0
Call trace for block $00007FCFAA550200 size 24
  $000000000046CEE4
Call trace for block $00007FCFAA55C180 size 120
  $0000000000465110
Call trace for block $00007FCFAA550700 size 24
  $000000000046CD34
Call trace for block $00007FCFAA550600 size 24
Call trace for block $00007FCFAA550500 size 24
Call trace for block $00007FCFAA550300 size 32
Call trace for block $00007FCFAA5E3AC0 size 192

Thank you for this most-useful program. Let me know if I can be of further help.

benibela commented 3 years ago

Somehow it became a debug build with memory leak and uninitialized variable detection enabled. And latter breaking the json format detection