src: avoid manual memory management in inspector by bnoordhuis · Pull Request #7906 · nodejs/node

@bnoordhuis added c++

Issues and PRs that require attention from people who are familiar with C++.

test

Issues and PRs related to the tests.

lib / src

Issues and PRs related to general changes in the lib or src directory.

inspector

Issues and PRs related to the V8 inspector protocol

labels

Jul 28, 2016
The inspector tests weren't closing open libuv handles properly,
making valgrind complain.  Strengthen the uv_loop_close() check
while here.

With this commit applied:

    $ valgrind ./out/Release/cctest 2>&1 | grep 'total heap' | cut -c31-
    1,017 allocs, 1,017 frees, 21,695,456 bytes allocated

PR-URL: nodejs#7906
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Make the inspector code easier to reason about by restructuring it
to avoid manual memory allocation and copying as much as possible.

An amusing side effect is that it reduces the total amount of memory
used in the test suite.

Before:

    $ valgrind ./out/Release/cctest 2>&1 | grep 'total heap' | cut -c31-
    1,017 allocs, 1,017 frees, 21,695,456 allocated

After:

    $ valgrind ./out/Release/cctest 2>&1 | grep 'total heap' | cut -c31-
    869 allocs, 869 frees, 14,484,641 bytes allocated

PR-URL: nodejs#7906
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>

cjihrig pushed a commit that referenced this pull request

Aug 10, 2016
The inspector tests weren't closing open libuv handles properly,
making valgrind complain.  Strengthen the uv_loop_close() check
while here.

With this commit applied:

    $ valgrind ./out/Release/cctest 2>&1 | grep 'total heap' | cut -c31-
    1,017 allocs, 1,017 frees, 21,695,456 bytes allocated

PR-URL: #7906
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>

cjihrig pushed a commit that referenced this pull request

Aug 10, 2016
Make the inspector code easier to reason about by restructuring it
to avoid manual memory allocation and copying as much as possible.

An amusing side effect is that it reduces the total amount of memory
used in the test suite.

Before:

    $ valgrind ./out/Release/cctest 2>&1 | grep 'total heap' | cut -c31-
    1,017 allocs, 1,017 frees, 21,695,456 allocated

After:

    $ valgrind ./out/Release/cctest 2>&1 | grep 'total heap' | cut -c31-
    869 allocs, 869 frees, 14,484,641 bytes allocated

PR-URL: #7906
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>