From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63F3FC43387 for ; Fri, 21 Dec 2018 15:31:34 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D1CC21903 for ; Fri, 21 Dec 2018 15:31:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kroah.com header.i=@kroah.com header.b="f4rPsKSe"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="vVsi6wIG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D1CC21903 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kroah.com Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.91) (envelope-from ) id 1gaMlh-0003AI-T3; Fri, 21 Dec 2018 10:31:17 -0500 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gaMlf-0003A6-C0 for kernelnewbies@kernelnewbies.org; Fri, 21 Dec 2018 10:31:16 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 50E3914E2; Fri, 21 Dec 2018 10:31:13 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 21 Dec 2018 10:31:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=YivSkZYZuCz7niup1F4SekWksfH pahpYeoV49YN/VsI=; b=f4rPsKSePcXCB3mB1cXGb15kbUyMNrCI2jvDV6Vrgg1 XPEv0uxvUxW7ktjbkxfNbAJDAc9LNdkdqrHPQ3iTzmO+JGKbqz5F3ABe48ydD/34 pWGPP3fC1qtLVjvWqYHZoOjrjbckPWwCdTizNMPtZQPR3EJujeAshbYNXDdi9Pod nEl86CH27n7Dq8sRIZTX9aMv6Jv9cZfbUdRYVZR0XUHLEOvDRuYGP76us/8FmWM9 bPGNwxQSYiUhIo+pezF+iiDgDPI+jksP1LcX+o5wnU3WDjjaNS0nimuw1ZBTSeHo 6TX+2a7Qfd3roh3eZ48WCQIUsN7duzTcPeTONX6AZZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=YivSkZ YZuCz7niup1F4SekWksfHpahpYeoV49YN/VsI=; b=vVsi6wIGYi+ICpVKuchXF2 68x4RAHqYwG+r9VcsXCaYpR2FlhrDA6zFj5JhUjvkyNJUsAMiyJl4Z4QBm/H1TZC 4s+QGTFwMd3TX0CsFJmRbzLOE0PNmVlVs85g94Jfstpfc1xz6aKS7abURMKuSHic knSB9O8lutFNnoyF3Hm661F6BL/eyviuZt79/9USFE+f1VKw4ur1cyC7Gji/hBYP FF8tl72FrzOzIs5l2yGQ5gZLxU+rrAsgO407SYjieTjRaE4y5WLn5GqXh2+xrdau omV2gwtWFMgTUa0n+xSB6TmsOxlYpT8/2/YoJZwJD0BBBaqwwFpEzcxjq2gTq1/g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudejhedgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecuogfuphgrmhfkphculdeftddtmdenucfjughrpeffhffvuffkfhggtggujggfse httdertddtredvnecuhfhrohhmpefirhgvghcumffjuceoghhrvghgsehkrhhorghhrdgt ohhmqeenucfkphepkeefrdekiedrkeelrddutdejnecurfgrrhgrmhepmhgrihhlfhhroh hmpehgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id B4DE2E4384; Fri, 21 Dec 2018 10:31:11 -0500 (EST) Date: Fri, 21 Dec 2018 16:31:10 +0100 From: Greg KH To: Lev Olshvang Subject: Re: How to signal kernel that shared library is not in use by any process anymore ? Message-ID: <20181221153110.GA14584@kroah.com> References: <965981545402036@sas1-2b3c3045b736.qloud-c.yandex.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <965981545402036@sas1-2b3c3045b736.qloud-c.yandex.net> User-Agent: Mutt/1.11.1 (2018-12-01) Cc: linux-il , kernelnewbies X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Fri, Dec 21, 2018 at 05:20:36PM +0300, Lev Olshvang wrote: > > Hi All, > > I have an executable (C++) which is the exclusive user of the some shared library that it uses only during the initialization phase. > > I would like to free memory used by this shared library, because I am running on embedded system. > > How can I achieve this? > > I know that dlopen() will load shared library, and hope that following dlclose() will free this lib memory. That right there is how you "achieve" this, call dlclose() and all will be fine. If your system needs the memory that was being used, it will reclaim it from the memory that was previously being used by the library at this point in time. Nothing else needs to be done. Have you tested this and found it not to work properly? > 1. Still I do not know what method should be used to make dynamic linker look again into executable and resolve symbols of the newly appeared symbols ? What "newly appeared symbols"? If you need to load the library again, call dlopen(). > 2. And how to tell the dynamic linker ld-linux.so to postpone the symbol resolution until dlopen() will load the library? It will not happen until you tell it to, right? > 3. Whether to compile and link executable with this library or leave unresolved symbols? It sounds like you don't really know what type of problem you are trying to solve here. Back up, what is the real issue you are having with the kernel at this point in time? thanks, greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies