With three test files generated with
clang -Xclang -ast-dump=json -c -x c++ - <<<'#include <array>'
and heaptrack ../kate/bin/kwrite test.json test2.json test3.json + scrolling to the end of all three open documents you get:
heaptrack ../kate/bin/kwrite test.json test2.json test3.json
master:
this patch: