From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1190 invoked by alias); 19 Nov 2014 10:39:31 -0000 Mailing-List: contact jit-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: Sender: jit-owner@gcc.gnu.org Received: (qmail 751 invoked by uid 89); 19 Nov 2014 10:39:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.98.4 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com From: David Malcolm To: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 10/21] PR jit/63854: Fix leak of worklist within jit-recording.c Date: Wed, 01 Jan 2014 00:00:00 -0000 Message-Id: <1416393981-39626-11-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1416393981-39626-1-git-send-email-dmalcolm@redhat.com> References: <1416393981-39626-1-git-send-email-dmalcolm@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-SW-Source: 2014-q4/txt/msg00153.txt.bz2 Fix this leak: 160 bytes in 5 blocks are definitely lost in loss record 154 of 228 at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x5D75D4F: xrealloc (xmalloc.c:177) by 0x4DE1710: void va_heap::reserve(vec*&, unsigned int, bool) (vec.h:310) by 0x4DDFAB5: vec::reserve(unsigned int, bool) (vec.h:1428) by 0x4DDFBFC: vec::reserve_exact(unsigned int) (vec.h:1448) by 0x4DDE588: vec::create(unsigned int) (vec.h:1463) by 0x4DD9B9F: gcc::jit::recording::function::validate() (jit-recording.c:2191) by 0x4DD7AD3: gcc::jit::recording::context::validate() (jit-recording.c:1005) by 0x4DD7660: gcc::jit::recording::context::compile() (jit-recording.c:848) by 0x4DD5BD2: gcc_jit_context_compile (libgccjit.c:2014) by 0x401CA4: test_jit (harness.h:190) by 0x401D88: main (harness.h:232) gcc/jit/ChangeLog: PR jit/63854 * jit-recording.c (recording::function::validate): Convert "worklist" from vec<> to autovec<> to fix a leak. --- gcc/jit/jit-recording.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c index 8daa8f2..8cce277 100644 --- a/gcc/jit/jit-recording.c +++ b/gcc/jit/jit-recording.c @@ -2187,8 +2187,7 @@ recording::function::validate () { /* Iteratively walk the graph of blocks, marking their "m_is_reachable" flag, starting at the initial block. */ - vec worklist; - worklist.create (m_blocks.length ()); + auto_vec worklist (m_blocks.length ()); worklist.safe_push (m_blocks[0]); while (worklist.length () > 0) { -- 1.8.5.3