{"action":"created","issue":{"url":"https://api.github.com/repos/clearlinux/distribution/issues/119","repository_url":"https://api.github.com/repos/clearlinux/distribution","labels_url":"https://api.github.com/repos/clearlinux/distribution/issues/119/labels{/name}","comments_url":"https://api.github.com/repos/clearlinux/distribution/issues/119/comments","events_url":"https://api.github.com/repos/clearlinux/distribution/issues/119/events","html_url":"https://github.com/clearlinux/distribution/issues/119","id":339962200,"node_id":"MDU6SXNzdWUzMzk5NjIyMDA=","number":119,"title":"valgrind not detecting simple leak with malloc","user":{"login":"cmarcelo","id":10478,"node_id":"MDQ6VXNlcjEwNDc4","avatar_url":"https://avatars3.githubusercontent.com/u/10478?v=4","gravatar_id":"","url":"https://api.github.com/users/cmarcelo","html_url":"https://github.com/cmarcelo","followers_url":"https://api.github.com/users/cmarcelo/followers","following_url":"https://api.github.com/users/cmarcelo/following{/other_user}","gists_url":"https://api.github.com/users/cmarcelo/gists{/gist_id}","starred_url":"https://api.github.com/users/cmarcelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmarcelo/subscriptions","organizations_url":"https://api.github.com/users/cmarcelo/orgs","repos_url":"https://api.github.com/users/cmarcelo/repos","events_url":"https://api.github.com/users/cmarcelo/events{/privacy}","received_events_url":"https://api.github.com/users/cmarcelo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"VictorRodriguez","id":327548,"node_id":"MDQ6VXNlcjMyNzU0OA==","avatar_url":"https://avatars3.githubusercontent.com/u/327548?v=4","gravatar_id":"","url":"https://api.github.com/users/VictorRodriguez","html_url":"https://github.com/VictorRodriguez","followers_url":"https://api.github.com/users/VictorRodriguez/followers","following_url":"https://api.github.com/users/VictorRodriguez/following{/other_user}","gists_url":"https://api.github.com/users/VictorRodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/VictorRodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VictorRodriguez/subscriptions","organizations_url":"https://api.github.com/users/VictorRodriguez/orgs","repos_url":"https://api.github.com/users/VictorRodriguez/repos","events_url":"https://api.github.com/users/VictorRodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/VictorRodriguez/received_events","type":"User","site_admin":false},"assignees":[{"login":"VictorRodriguez","id":327548,"node_id":"MDQ6VXNlcjMyNzU0OA==","avatar_url":"https://avatars3.githubusercontent.com/u/327548?v=4","gravatar_id":"","url":"https://api.github.com/users/VictorRodriguez","html_url":"https://github.com/VictorRodriguez","followers_url":"https://api.github.com/users/VictorRodriguez/followers","following_url":"https://api.github.com/users/VictorRodriguez/following{/other_user}","gists_url":"https://api.github.com/users/VictorRodriguez/gists{/gist_id}","starred_url":"https://api.github.com/users/VictorRodriguez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VictorRodriguez/subscriptions","organizations_url":"https://api.github.com/users/VictorRodriguez/orgs","repos_url":"https://api.github.com/users/VictorRodriguez/repos","events_url":"https://api.github.com/users/VictorRodriguez/events{/privacy}","received_events_url":"https://api.github.com/users/VictorRodriguez/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-07-10T18:41:52Z","updated_at":"2018-07-17T17:50:06Z","closed_at":null,"author_association":"NONE","body":"Compiling the following program in Clear Linux, then running valgrind show no memory leaks. Double checked in Fedora and as expected there it shows the memory leaks.\r\n\r\n```\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n\r\nint main() {\r\n\tint *a;\r\n\tfor (int i = 0; i < 10; i++) {\r\n\t\ta = malloc(100000);\r\n\t\tprintf(\"%p\\n\", a);\r\n\t}\r\n\treturn 0;\r\n}\r\n```\r\n\r\nFor the record, the compilation attempts:\r\n\r\n```\r\n$ gcc program.c\r\n$ gcc -O0 program.c\r\n$ CFLAGS= gcc program.c                     # Clear does set CFLAGS by default.\r\n$ CFLAGS= gcc -O0 program.c\r\n```\r\n\r\nAnd the valgrind result in Clear:\r\n```\r\n==536== Memcheck, a memory error detector\r\n==536== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.\r\n==536== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info\r\n==536== Command: ./a.out\r\n==536== \r\n0x402b260\r\n0x4043d20\r\n0x405c3d0\r\n0x4074a80\r\n0x408d130\r\n0x40a57e0\r\n0x40bde90\r\n0x40d6540\r\n0x40eebf0\r\n0x41072a0\r\n==536== \r\n==536== HEAP SUMMARY:\r\n==536==     in use at exit: 0 bytes in 0 blocks\r\n==536==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated\r\n==536== \r\n==536== All heap blocks were freed -- no leaks are possible\r\n==536== \r\n==536== For counts of detected and suppressed errors, rerun with: -v\r\n==536== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)\r\n```\r\n\r\nAnd the output with -v:\r\n\r\n```\r\n$ valgrind -v ./a.out \r\n==720== Memcheck, a memory error detector\r\n==720== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.\r\n==720== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info\r\n==720== Command: ./a.out\r\n==720== \r\n--720-- Valgrind options:\r\n--720--    -v\r\n--720-- Contents of /proc/version:\r\n--720--   Linux version 4.16.11-262.kvm (mockbuild@kojibld02) (gcc version 8.1.1 20180514 (Clear Linux OS for Intel Architecture)) #2 SMP Tue Jun 26 18:05:51 UTC 2018\r\n--720-- \r\n--720-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-rdtscp-sse3-avx\r\n--720-- Page sizes: currently 4096, max supported 4096\r\n--720-- Valgrind library directory: /usr/lib64/valgrind\r\n--720-- Reading syms from /home/c/a.out\r\n--720-- Reading syms from /usr/lib64/ld-2.27.so\r\n--720-- Reading syms from /usr/lib64/valgrind/memcheck-amd64-linux\r\n--720-- ELF section outside all mapped regions\r\n--720-- Scheduler: using generic scheduler lock implementation.\r\n--720-- Reading suppressions file: /usr/lib64/valgrind/default.supp\r\n==720== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-720-by-c-on-???\r\n==720== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-720-by-c-on-???\r\n==720== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-720-by-c-on-???\r\n==720== \r\n==720== TO CONTROL THIS PROCESS USING vgdb (which you probably\r\n==720== don't want to do, unless you know exactly what you're doing,\r\n==720== or are doing some strange experiment):\r\n==720==   /usr/lib64/valgrind/../../bin/vgdb --pid=720 ...command...\r\n==720== \r\n==720== TO DEBUG THIS PROCESS USING GDB: start GDB like this\r\n==720==   /path/to/gdb ./a.out\r\n==720== and then give GDB the following command\r\n==720==   target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=720\r\n==720== --pid is optional if only one valgrind process is running\r\n==720== \r\n--720-- REDIR: 0x401ee10 (ld-linux-x86-64.so.2:strlen) redirected to 0x5805c098 (???)\r\n--720-- REDIR: 0x401ebf0 (ld-linux-x86-64.so.2:index) redirected to 0x5805c0b2 (???)\r\n--720-- Reading syms from /usr/lib64/valgrind/vgpreload_core-amd64-linux.so\r\n--720-- ELF section outside all mapped regions\r\n--720-- Reading syms from /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so\r\n--720-- ELF section outside all mapped regions\r\n--720-- Reading syms from /usr/lib64/libc-2.27.so\r\n--720--   Considering /usr/lib/debug/.build-id/dc/085cc6448ccd47df959c24ed40be3b26a9b1a5.debug ..\r\n--720--   .. build-id is valid\r\n0x402b260\r\n0x4043d20\r\n0x405c3d0\r\n0x4074a80\r\n0x408d130\r\n0x40a57e0\r\n0x40bde90\r\n0x40d6540\r\n0x40eebf0\r\n0x41072a0\r\n==720== \r\n==720== HEAP SUMMARY:\r\n==720==     in use at exit: 0 bytes in 0 blocks\r\n==720==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated\r\n==720== \r\n==720== All heap blocks were freed -- no leaks are possible\r\n==720== \r\n==720== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)\r\n==720== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)\r\n```\r\n\r\nOne (wild) guess would be that there is something mismatch between the glibc version and the suppressions distributed in Clear Linux."},"comment":{"url":"https://api.github.com/repos/clearlinux/distribution/issues/comments/405668994","html_url":"https://github.com/clearlinux/distribution/issues/119#issuecomment-405668994","issue_url":"https://api.github.com/repos/clearlinux/distribution/issues/119","id":405668994,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTY2ODk5NA==","user":{"login":"phmccarty","id":1093718,"node_id":"MDQ6VXNlcjEwOTM3MTg=","avatar_url":"https://avatars1.githubusercontent.com/u/1093718?v=4","gravatar_id":"","url":"https://api.github.com/users/phmccarty","html_url":"https://github.com/phmccarty","followers_url":"https://api.github.com/users/phmccarty/followers","following_url":"https://api.github.com/users/phmccarty/following{/other_user}","gists_url":"https://api.github.com/users/phmccarty/gists{/gist_id}","starred_url":"https://api.github.com/users/phmccarty/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phmccarty/subscriptions","organizations_url":"https://api.github.com/users/phmccarty/orgs","repos_url":"https://api.github.com/users/phmccarty/repos","events_url":"https://api.github.com/users/phmccarty/events{/privacy}","received_events_url":"https://api.github.com/users/phmccarty/received_events","type":"User","site_admin":false},"created_at":"2018-07-17T17:50:06Z","updated_at":"2018-07-17T17:50:06Z","author_association":"NONE","body":"Valgrind memcheck is not reporting any allocations at all, let alone leaks. So this looks like either a valgrind bug or (more likely) a bug in the way valgrind is integrated in Clear Linux."}}
{"actor":{"display_login":"phmccarty"}}