GNU bug report logs -
#31852
Make memory-limit obsolete
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Sat, 16 Jun 2018 01:35:01 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31852 in the body.
You can then email your comments to 31852 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31852
; Package
emacs
.
(Sat, 16 Jun 2018 01:35:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 16 Jun 2018 01:35:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: patch
The memory-limit function has an implementation that is a relic of
long-ago days when the heap was allocated via sbrk. This assumption is
often no longer true now that ASLR is popular, and once we get portable
dumping work it'll be true even less often. Since memory-limit returns
nonsense so often and since nobody cares, we can and should mark
memory-limit as obsolete. On its way out we can move it to a Lisp
implementation and cause it to be at least somewhat more plausible.
Proposed patches attached. The first patch moves memory-limit to Lisp,
the second one marks it obsolete. I didn't know where to put the Lisp
implementation so I put it into lisp/subr.el.
[0001-Rewrite-memory-limit-in-Lisp.patch (text/x-patch, attachment)]
[0002-Obsolete-memory-limit.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31852
; Package
emacs
.
(Sat, 16 Jun 2018 06:32:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 31852 <at> debbugs.gnu.org (full text, mbox):
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Fri, 15 Jun 2018 18:33:47 -0700
>
> The memory-limit function has an implementation that is a relic of
> long-ago days when the heap was allocated via sbrk. This assumption is
> often no longer true now that ASLR is popular, and once we get portable
> dumping work it'll be true even less often. Since memory-limit returns
> nonsense so often and since nobody cares, we can and should mark
> memory-limit as obsolete. On its way out we can move it to a Lisp
> implementation and cause it to be at least somewhat more plausible.
>
> Proposed patches attached. The first patch moves memory-limit to Lisp,
> the second one marks it obsolete. I didn't know where to put the Lisp
> implementation so I put it into lisp/subr.el.
I don't have anything against moving this to Lisp (provided that all
the platforms we care about have a non-trivial implementation of
process-attributes), but I don't understand what we gain by declaring
this tiny function obsolete, especially since the alternative proposed
in the warning is exactly what's used in the proposed Lisp
implementation. Wouldn't it be enough just to add to the function's
documentation a note that the estimation should be expected to be
inaccurate with modern memory-management technologies?
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31852
; Package
emacs
.
(Sat, 16 Jun 2018 13:40:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 31852 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii wrote:
> I don't understand what we gain by declaring
> this tiny function obsolete
Nobody uses the function (clearly, since it doesn't work) so we gain simplicity,
which is a win.
> Wouldn't it be enough just to add to the function's
> documentation a note that the estimation should be expected to be
> inaccurate with modern memory-management technologies?
Complicating the documentation would work against the goal of simplicity. If the
goal is something other than simplicity, it'd be helpful to know what the goal
is before proposing a different patch 2. The idea behind patch 2 is that
simplicity trumps compatibility here, as nobody uses the function and nobody
will use it even if patch 1 is applied, partly because of the inaccuracies that
you mention.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31852
; Package
emacs
.
(Sat, 16 Jun 2018 15:03:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 31852 <at> debbugs.gnu.org (full text, mbox):
> Cc: 31852 <at> debbugs.gnu.org
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Sat, 16 Jun 2018 06:38:55 -0700
>
> Eli Zaretskii wrote:
> > I don't understand what we gain by declaring
> > this tiny function obsolete
>
> Nobody uses the function (clearly, since it doesn't work) so we gain simplicity,
> which is a win.
If nobody uses the function, I see no gain at all, because obsoleting
a function tells those who use it not to.
> > Wouldn't it be enough just to add to the function's
> > documentation a note that the estimation should be expected to be
> > inaccurate with modern memory-management technologies?
>
> Complicating the documentation would work against the goal of
> simplicity.
Then let's just move this to Lisp, and do nothing else. That's even
simpler, IMO.
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Sat, 16 Jun 2018 15:36:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
bug acknowledged by developer.
(Sat, 16 Jun 2018 15:36:03 GMT)
Full text and
rfc822 format available.
Message #19 received at 31852-done <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii wrote:
> If nobody uses the function, I see no gain at all, because obsoleting
> a function tells those who use it not to.
If Emacs has useless and confusing features that consume documentation space and
implementation resources, that is a net harm to current and future users.
Omitting such features is therefore a net gain to users. The benefit to users by
omitting useless and confusing features is worth the maintenance cost to us of
obsoleting these features.
That being said, it appears I haven't convinced you to obsolete memory-limit, so
I installed patch 1 but not patch 2 and am closing the bug report.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31852
; Package
emacs
.
(Sat, 16 Jun 2018 15:52:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 31852 <at> debbugs.gnu.org (full text, mbox):
> Eli Zaretskii wrote:
>
>> If nobody uses the function, I see no gain at all, because obsoleting
>> a function tells those who use it not to.
>
> If Emacs has useless and confusing features that consume documentation
> space and
> implementation resources, that is a net harm to current and future users.
> Omitting such features is therefore a net gain to users. The benefit to
> users by
> omitting useless and confusing features is worth the maintenance cost to
> us of
> obsoleting these features.
>
> That being said, it appears I haven't convinced you to obsolete
> memory-limit, so
> I installed patch 1 but not patch 2 and am closing the bug report.
I agree with obsoleting memory-limit. I don't like the vsize patch you
installed though: what does the amount of address space reserved actually
tell anyone? There's no relationship to actual resource consumption.
IMHO, memory-limit should return a combination of the Lisp heap size with
whatever malloc says is its own heap size.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#31852
; Package
emacs
.
(Sat, 16 Jun 2018 16:28:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 31852 <at> debbugs.gnu.org (full text, mbox):
Daniel Colascione wrote:
> I agree with obsoleting memory-limit. I don't like the vsize patch you
> installed though: what does the amount of address space reserved actually
> tell anyone? There's no relationship to actual resource consumption.
It's not that good a number, true; but it's better than the number we were
returning, which was typically nonsense.
One of the benefits of moving memory-limit to Lisp was the removal of the bogus
call to sbrk. Emacs should never call sbrk, and once the portable dumper code is
merged, Emacs won't ever need to call sbrk again. Yay!
All things considered, I'd rather not go down the rabbit hole of trying to
improve memory-limit further, because memory-limit was a mistake in the first
place and nobody uses it (and rightly so) and we should be deprecating it rather
than trying to improve it. That being said, if you'd like to make it better
please feel free.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 16 Jul 2018 11:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 343 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.