getappmap / scanner

Code scanning, linting, assertions and alerts.
Other
0 stars 0 forks source link

fix: Prevent accumulation of AppMap data while scanning #99

Closed dustinbyrne closed 2 years ago

dustinbyrne commented 2 years ago

Previously, event references in findings would cause entire AppMaps to stay loaded into memory. With this change we now create a shallow copy of Event objects to break these references.

I was able to confirm that the memory usage no longer grows dramatically with each AppMap scanned via the node inspector built into Chrome. In my local testing, total heap size drops from ~250MB to ~35MB after a full ci run.

kgilpin commented 2 years ago

This looks good, I think it’s worth a test case to show that the field accessors and JSON work as expected.

dustinbyrne commented 2 years ago

I moved the cloning logic out into it's own file because it should really reside in @appland/models anyway. I also added some tests to validate that the cloned object performs in the same manner as the source object.

appland-release commented 2 years ago

:tada: This PR is included in version 1.40.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: