From patchwork Mon Mar 18 01:33:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Di Chen X-Patchwork-Id: 87299 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8565E3858404 for ; Mon, 18 Mar 2024 01:34:00 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 1851B3858D37 for ; Mon, 18 Mar 2024 01:33:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1851B3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1851B3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710725631; cv=none; b=ka0NLA0J0Odo3Y52j+nQCV5RLuA7zkne8docwzr/jt/dzfY28BHkQh4KX3m5ORn7Wm3vdXXho4/jCwGedXEaCv9Gdgpu97/QyMIP52z59mc0viSVlMoMDxOHvqR5mIcIf8qyhMdIGk8MALDQzQ6N5N1VmAxjvVQtQACvhqaX8T0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710725631; c=relaxed/simple; bh=BhSt6gFZQ+N6ZgAZYYkoFmXYat+Vdpfe462KOisOtR4=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Fa+R961hEl4GFfu90v/y6zXCsZMVlPxiMVU7lvJ+bVkzh+vnyCnIahLeHVAXP21oOpnQK5Gq5d+ogeSCTJ3s4Ov9s5jfGsD0bX17Is3g5o0ZanSrwRhvQKU8K9KqJ1f5w2gqzbvXYHsimBea9eoko8XbAKt5PJm7uRTUDonJFOw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710725620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=JlxeXGf0PBk7649Y/8Kb84ChtF+W6kutUXHtIYmSH9M=; b=io6+dhBwGzLVpRq/OZJr33paI2gAB88Hoe8+l8tAK6xOlFV65G5pANrH6xeCoSyoYFWvBa I99zQKNvJ4wqZZBrw1m87iatI4gOUcw+iHoE30ho4z/gFN3nRYqkRyE3WG3Xb6TCZKUFC7 jpA/M/gNljyth3Msz6fFJUENRR4L4og= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-654-nxtppVFcNwuu4TBdexOGJA-1; Sun, 17 Mar 2024 21:33:37 -0400 X-MC-Unique: nxtppVFcNwuu4TBdexOGJA-1 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-513eaadf2bbso473648e87.3 for ; Sun, 17 Mar 2024 18:33:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710725616; x=1711330416; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dbTr8IQM9x6QzYRiuiwIh10dCzEeHU5mS5JKXhttR9M=; b=k+WVxufap5quAdPrbFkPWC297RqpE3Kzkvy8XfHE6ZhnKEBSjzQ9qA+rWLjV9rf89g Y4EbpXsTiqlpstjLbRlz+vEhj3r0MMg0qqWBw4vLT4TkFb1cbRNPka9PzEd4hy1RL6h4 ya2vOdoZiCsRwcbQHqDROhBeRVDvxefmzYBb/SPwocTnHuw7w3lkmQn4bRKB2gQQoWCZ onM19DJD6hiyaXAOnsfWSZNhm/Fd8tIrGqY1pdnYOAaEfAmV93QJR+BfTAKgcZq6loXA f+9VZ0XJv1WzW4VqmydHucbPr7S8EcOxz9t3th4k7KmZshRV5pRZ4xZqtLnCzhP2nymS u2cA== X-Gm-Message-State: AOJu0YyoMgQ0+FlENF8V+Mvgu01RH5mV36i0pg140Yvd6yTkfDi4/43m 1PEtqrGfFXALm4rr2oJsyWCA9KROB6toyGkK4mvXYY7pooE2L4K8SYDHEbVYp8HAFKsbzWTuU9V PWX3MDAPcEGGzZrwPT3aUfV12Ag24jzYUnFnTrN6Wu7uMecJOKjNUTkYsibTeBuEoc5DiWAaVn5 2mN6CWPIteKXzrivaasE0WJIJ4fDvKv2Z5jtzRumUTXEYjXtvB X-Received: by 2002:a2e:2283:0:b0:2d4:71b9:4e3 with SMTP id i125-20020a2e2283000000b002d471b904e3mr7002365lji.51.1710725616255; Sun, 17 Mar 2024 18:33:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHkUV423kjYxEUVhIdHEInjAaoQPdemCu89SBB1qSIK4/GkhZQQSdzJkU9BN/YlKQ08wXShksWe6mJ3UmKN6vE= X-Received: by 2002:a2e:2283:0:b0:2d4:71b9:4e3 with SMTP id i125-20020a2e2283000000b002d471b904e3mr7002353lji.51.1710725615662; Sun, 17 Mar 2024 18:33:35 -0700 (PDT) MIME-Version: 1.0 From: Di Chen Date: Mon, 18 Mar 2024 09:33:24 +0800 Message-ID: Subject: [PATCH] debuginfod.cxx: periodically malloc_trim() To: elfutils-devel@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org From 93cfe0b3e8d51eb18c5807e4b72c17920aefb422 Mon Sep 17 00:00:00 2001 From: Di Chen Date: Mon, 18 Mar 2024 09:06:19 +0800 Subject: [PATCH] debuginfod.cxx: periodically malloc_trim() Add malloc_trim() for releasing memory which is allocated for temporary purposes, e.g. answering queries, adding data to the database during scans. https://sourceware.org/bugzilla/show_bug.cgi?id=31103 Signed-off-by: Di Chen --- debuginfod/debuginfod.cxx | 2 ++ 1 file changed, 2 insertions(+) #if 0 /* PR31265: don't jettison cache unnecessarily */ From 93cfe0b3e8d51eb18c5807e4b72c17920aefb422 Mon Sep 17 00:00:00 2001 From: Di Chen Date: Mon, 18 Mar 2024 09:06:19 +0800 Subject: [PATCH] debuginfod.cxx: periodically malloc_trim() Add malloc_trim() for releasing memory which is allocated for temporary purposes, e.g. answering queries, adding data to the database during scans. https://sourceware.org/bugzilla/show_bug.cgi?id=31103 Signed-off-by: Di Chen --- debuginfod/debuginfod.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 72617848..6e1b43ad 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -70,6 +70,7 @@ extern "C" { #include #include #include +#include #include @@ -4225,6 +4226,7 @@ void groom() sqlite3_db_release_memory(db); // shrink the process if possible sqlite3_db_release_memory(dbq); // ... for both connections + malloc_trim(0); // PR31103: release memory allocated for temporary purposes debuginfod_pool_groom(); // and release any debuginfod_client objects we've been holding onto #if 0 /* PR31265: don't jettison cache unnecessarily */ -- 2.41.0