[{"id":19766,"web_url":"https://patchwork.libcamera.org/comment/19766/","msgid":"<20210922045529.GB4382@pyrite.rasen.tech>","date":"2021-09-22T04:55:29","subject":"Re: [libcamera-devel] [PATCH v2 1/3] test:\n\tgstreamer_single_stream_test: Fix memory leak","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Vedant,\n\nOn Tue, Sep 21, 2021 at 11:09:53PM +0530, Vedant Paranjape wrote:\n> The test hold a valid reference to convert0_ and sink0_ but\n> not released. This results in a memory leak and can be checked\n> via valgrind. Drop the references with test cleanup() virtual\n> function.\n> \n> Valgrind log (glib and gst suppression files were used):\n> ==345380== LEAK SUMMARY:\n> ==345380==    definitely lost: 1,688 bytes in 2 blocks\n> ==345380==    indirectly lost: 7,069 bytes in 42 blocks\n> \n> The patch fixes the leaks reported by valgrind above to:\n> ==348870== LEAK SUMMARY:\n> ==348870==    definitely lost: 0 bytes in 0 blocks\n> ==348870==    indirectly lost: 0 bytes in 0 blocks\n> \n> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  test/gstreamer/gstreamer_single_stream_test.cpp | 6 ++++++\n>  1 file changed, 6 insertions(+)\n> \n> diff --git a/test/gstreamer/gstreamer_single_stream_test.cpp b/test/gstreamer/gstreamer_single_stream_test.cpp\n> index 7292f3280617..2b561d6bf9f2 100644\n> --- a/test/gstreamer/gstreamer_single_stream_test.cpp\n> +++ b/test/gstreamer/gstreamer_single_stream_test.cpp\n> @@ -72,6 +72,12 @@ protected:\n>  \t\treturn TestPass;\n>  \t}\n>  \n> +\tvoid cleanup() override\n> +\t{\n> +\t\tg_clear_object(&convert0_);\n> +\t\tg_clear_object(&sink0_);\n> +\t}\n> +\n>  private:\n>  \tGstElement *convert0_;\n>  \tGstElement *sink0_;\n> -- \n> 2.25.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 00759BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Sep 2021 04:55:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 529CB6918E;\n\tWed, 22 Sep 2021 06:55:39 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EE3986012C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Sep 2021 06:55:37 +0200 (CEST)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 08C5DF1;\n\tWed, 22 Sep 2021 06:55:35 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ud0uDNsJ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1632286537;\n\tbh=j6SxiC9SIaHh9mA/hvl5e8xWq9/AF591iAtD0CR12Wc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ud0uDNsJffdWwpaAaEUlQ3fKtYhU+92aMTZc98M/0zxNIYfNeVE8RstHr2vmMS4uS\n\tLXF/24n9gzQ7Rd0BKMbGT5lt8pJWxY+Z2dNmt9NBIS2dEQ/BT/SDrPtHVzHGCCG/lP\n\tB9BLDXNWjynXWO2eTPTaAWG3NnPkyJDZ6CYSmFT8=","Date":"Wed, 22 Sep 2021 13:55:29 +0900","From":"paul.elder@ideasonboard.com","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Message-ID":"<20210922045529.GB4382@pyrite.rasen.tech>","References":"<20210921173955.20408-1-vedantparanjape160201@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20210921173955.20408-1-vedantparanjape160201@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2 1/3] test:\n\tgstreamer_single_stream_test: Fix memory leak","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org,\n\tNicolas Dufresne <nicolas.dufresne@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]