==6972== Memcheck, a memory error detector
==6972== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==6972== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==6972== Command: /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench
==6972==
==6972== Warning: set address range perms: large range [0x4200000000, 0x14200100000) (noaccess)
^C==6972==
==6972== Process terminating with default action of signal 2 (SIGINT)
==6972== at 0x4D2E3DB: kill (syscall-template.S:78)
==6972== by 0x211DB28: exitBySignal (RtsStartup.c:627)
==6972== by 0x211DDD1: shutdownHaskellAndSignal (RtsStartup.c:592)
==6972== by 0x1FC12D9: ??? (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972==
==6972== HEAP SUMMARY:
==6972== in use at exit: 70,456 bytes in 17 blocks
==6972== total heap usage: 1,104 allocs, 1,087 frees, 522,254 bytes allocated
==6972==
==6972== 0 bytes in 1 blocks are definitely lost in loss record 1 of 14
==6972== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==6972== by 0x15605A3: op_send_initial_metadata (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972== by 0x1538B7B: grpczmhaskellzmcorezm0zi3zi0zm835310fa19e8773ca754a75c240f6e73c79cc57e1c1ee407f6993ad725919bb0_NetworkziGRPCziLowLevelziOp_zdwsetOpArray_info (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972==
==6972== 0 bytes in 1 blocks are definitely lost in loss record 2 of 14
==6972== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==6972== by 0x156076D: op_send_status_server (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972== by 0x150E183: grpczmhaskellzmcorezm0zi3zi0zm835310fa19e8773ca754a75c240f6e73c79cc57e1c1ee407f6993ad725919bb0_NetworkziGRPCziUnsafeziOp_zdwopSendStatusServer_info (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972==
==6972== 16 bytes in 1 blocks are definitely lost in loss record 7 of 14
==6972== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==6972== by 0x155FDA1: grpc_completion_queue_pluck_ (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972== by 0x152C698: grpczmhaskellzmcorezm0zi3zi0zm835310fa19e8773ca754a75c240f6e73c79cc57e1c1ee407f6993ad725919bb0_NetworkziGRPCziUnsafe_zdwgrpcCompletionQueuePluck_info (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972== by 0x8000000000000000: ???
==6972==
==6972== 320 bytes in 1 blocks are definitely lost in loss record 12 of 14
==6972== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==6972== by 0x4C5C391: gpr_malloc (in /usr/local/lib/libgpr.so.14.0.0)
==6972== by 0x4B2AE6F: grpc_raw_compressed_byte_buffer_create (in /usr/local/lib/libgrpc.so.14.0.0)
==6972== by 0x156062D: op_send_message (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972== by 0x1538AE7: grpczmhaskellzmcorezm0zi3zi0zm835310fa19e8773ca754a75c240f6e73c79cc57e1c1ee407f6993ad725919bb0_NetworkziGRPCziLowLevelziOp_zdwsetOpArray_info (in /srv/grpc_bench/haskell_grpc_haskell_bench/dist-newstyle/build/x86_64-linux/ghc-8.10.7/grpc-haskell-bench-0.1.0.0/x/haskell-grpc-haskell-bench/build/haskell-grpc-haskell-bench/haskell-grpc-haskell-bench)
==6972==
==6972== LEAK SUMMARY:
==6972== definitely lost: 336 bytes in 4 blocks
==6972== indirectly lost: 0 bytes in 0 blocks
==6972== possibly lost: 0 bytes in 0 blocks
==6972== still reachable: 70,120 bytes in 13 blocks
==6972== suppressed: 0 bytes in 0 blocks
==6972== Reachable blocks (those to which a pointer was found) are not shown.
==6972== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==6972==
==6972== For lists of detected and suppressed errors, rerun with: -s
==6972== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
Leaks
memory allocated by grpc_byte_buffer_copy fromop_send_message seems redundant
memory allocated by malloc from op_send_initial_metadata
memory allocated by malloc from op_send_status_server
[x] ~memory allocated by malloc from grpc_completion_queue_pluck_~
Hi, I'm trying to include this library in grpc_bench. However, there were some critical memory leaks that failed the bench.
Reproduce
Example server code: https://github.com/LesnyRumcajs/grpc_bench/pull/243
Start server:
A simple request:
Valgrind output:
Leaks
grpc_byte_buffer_copy
fromop_send_message
seems redundantmalloc
fromop_send_initial_metadata
malloc
fromop_send_status_server
malloc
fromgrpc_completion_queue_pluck_
~