From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 29 14:04:18 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 57251A43 for ; Fri, 29 Mar 2013 14:04:18 +0000 (UTC) (envelope-from freebsd-lists@be-well.ilk.org) Received: from be-well.ilk.org (be-well.ilk.org [23.30.133.173]) by mx1.freebsd.org (Postfix) with ESMTP id 30ABD75D for ; Fri, 29 Mar 2013 14:04:17 +0000 (UTC) Received: from lowell-desk.lan (lowell-desk.lan [172.30.250.41]) by be-well.ilk.org (Postfix) with ESMTP id EC1D233C6E; Fri, 29 Mar 2013 10:04:11 -0400 (EDT) Received: by lowell-desk.lan (Postfix, from userid 1147) id 39B8239829; Fri, 29 Mar 2013 10:04:11 -0400 (EDT) From: Lowell Gilbert To: Rod Person Subject: Re: Help porting Linux app - getting Free Memory and Real Memory References: <5156316F.9050202@rodperson.com> <20130329032845.GG81066@server.rulingia.com> <44li962xmp.fsf@lowell-desk.lan> <51559451.9050708@rodperson.com> Date: Fri, 29 Mar 2013 10:04:11 -0400 In-Reply-To: <51559451.9050708@rodperson.com> (Rod Person's message of "Fri, 29 Mar 2013 09:17:05 -0400") Message-ID: <44haju2tgk.fsf@lowell-desk.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: Lowell Gilbert , freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Mar 2013 14:04:18 -0000 Rod Person writes: > On 03/29/13 08:34, Lowell Gilbert wrote: >> Peter Jeremy writes: >> >>> On 2013-Mar-29 20:27:27 -0400, Rod Person wrote: >>>> Everything is going we except that the program gives warnings that there >>>> isn't enough free memory on the system to perform certain actions. >>> That premise sounds suspiciously like the upstream author doesn't >>> understand how Unix VM works. >> To be more blunt, these checks may well be useless on Linux. >> On a quick look, you seem to maintain three ports: idutils, mspdebug, >> and jogl. I wouldn't expect a free-memory check to be appropriate on any >> of those. > Really? The port in question if graphics/fotoxx. I have no involvement > in the others. For the latter two, I'm not even sure what they are. Oops. I apologize; I actually looked for ports maintained by the other person who responded to you. Very silly mistake on my part. I don't think a free-memory check is appropriate here, either. >> In any case, the definition of "free memory" is different between the VM >> systems in Linux and BSD . Even if the checks do make sense, the FreeBSD >> implementation would at the minimum have to include all of the pages >> that are allocated but not mapped. > Yes I have read this. Fotoxx uses free memory calculation when applying > effects to images. It looks at the image size then calculates how much > memory it needs to apply an effect, such as image sharpening. For > example, on a 4.5MB jpg file it seems to calculate that 40MB of free > memory is need to apply sharpening to the image. 40MB doesn't seem like > a lot of memory to me, but since the application way of figuring free > memory is Linux specific the warning dialog appear, although it seem to > have no ill effect on actually applying the sharpening effect. I would recommend removing the check completely. The upstream author should do this for the Linux version as well; it really doesn't make sense in a system that supports virtual memory. If you decide to support it anyway to make some kind of performance guarantees, you probably should check against all of user memory; "free" memory is by definition being underutilized.