Inspecting code results in Bad JSON

I’m trying to track down a memory leak in some code which runs on an ESP 01. I was thrilled to see some static analysis tools had been included, however I’m having some trouble with them.

If I “Inspect” my project for memory, I get a nice little list. However, if I flip the switch for “Check Code”, it goes about half way and then dies with Bad JSON.

After reading some github issues, I brought up a pio terminal and tried:

pio check --skip-packages

–skip-packages, as it chokes on some ESP core file without it and I saw in another forum post that this would help it proceed, which it does.

That call, over five to ten minutes, proceeds to run my 32gb system almost completely out of ram (icons stop drawing, etc). It did show a few low-severity issues before causing me to be logged out of Windows! I don’t think it made it very far though.

I’m able to build and flash my ESP01 with this project fine. Any thoughts on how to get the GUI to finish “Inspecting” in a reasonable amount of time?

Thanks!

platformio.ini:

[env:esp01]
platform = espressif8266
board = esp01
framework = arduino
lib_deps = 
    adafruit/Adafruit NeoPixel@^1.7.0
    painlessmesh/painlessMesh@^1.4.5
    yiannisbourkelis/Uptime Library@^1.0.0
monitor_port = COM4
monitor_speed = 115200
build_type = debug
monitor_filters = esp8266_exception_decoder
check_tool = cppcheck

About:
Version: 1.51.1 (user setup)
Commit: e5a624b788d92b8d34d1392e4c4d9789406efe8f
Date: 2020-11-10T23:34:32.027Z
Electron: 9.3.3
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Windows_NT x64 10.0.19041

I also have run into this issue. Inspect memory works, inspect code fails with “Bad JSON”. I have reproduced the problem with the simple blink example used on the platformio website and the following platformio.ini:

[env:uno]
platform = atmelavr
board = uno
framework = arduino

[env:zero]
platform = atmelsam
board = zero
framework = arduino

[env:seeed_wio_terminal]
platform = atmelsam
board = seeed_wio_terminal
framework = arduino
platform_packages = framework-arduino-samd-seeed@https://github.com/Seeed-Studio/ArduinoCore-samd.git

Inspecting with the Uno env both memory and code work. Inspecting with either of the other two env’s fail as noted above. All three will compile and run ok.

Sounds easy to reproduce. Would you be able to write up an issue for it?

Done issue logged as:

Inspect Code fails on certain board types with “Bad JSON” #2262

1 Like

Thanks for taking the time to do that!