From: arthur miller <arthur.miller@live.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Sv: A possible small tiny bug in win32 FULL_DEBUG build and some questions
Date: Fri, 3 Jan 2025 16:19:06 +0000 [thread overview]
Message-ID: <AS8PR02MB101078B4311129B4A820F592796152@AS8PR02MB10107.eurprd02.prod.outlook.com> (raw)
In-Reply-To: <86zfk8guvr.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 2833 bytes --]
> > From: arthur miller <arthur.miller@live.com>
> > CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> > Date: Fri, 3 Jan 2025 00:24:58 +0000
> >
> > (let ((cp (w32-get-console-codepage))
> > (cpo (w32-get-console-output-codepage)))
> > (dotimes (i 100000)
> > (w32-set-console-codepage i)
> > (w32-set-console-output-codepage i)
> > (w32-set-console-codepage (- i 10000))
> > (w32-set-console-output-codepage (- i 10000)))
> > (w32-set-console-codepage cp)
> > (w32-set-console-output-codepage cpo))
> >
> > Anyway, in the world of utf8 I guess nobody is using that code anyway,
> > so it does not really matter. Was just a little curiosa while I was
> > looking through the code for the reference.
>
> The codepages are still very much used in Emacs on Windows. The
> Windows UTF-8 support is rudimentary and marked "experimental" by MS.
> So we still need to consider the codepages when referencing external
> stuff.
Ok; thnks. I thought Emacs was doing its own coding/decoding, but I am
not yet familiar with that stuff. I guess I'll have more questions about
that stuff.
> > >> I don't see any usage of this function, neither in C code nor
> > >> in Lisp (I grepped through); so I guess it is just eventually only called from
> > >> the external packages or just interactively by the user. Is it worth to copy
> > >> the returned list into a local list and return that so that the global list can
> > >> be freed so not to leak that list in the case the user does not want to save
> > >> that list anyway?
> > >
> > >I don't understand where did you see a leak, and what kind of a leak
> > >is that, please elaborate.
> >
> > I am assuming that this function can't be used very often. If the user
> > calls it for some reason (debugging, curiosity, checking if a codepage
> > is loaded?), the list will be constructed, but probably not used in a
> > single usage. But the space allocated for it will be allocated until
> > Emacs exists. If space is used but not needed than in a sense, it is a
> > memory leak.
>
> That's not a memory leak in my book, no. A value that is computed
> once and left to be used for the entire session is not a leak.
Mnjah; of course, I don't know why this particular function was
implemented, but my guess is debugging or just a simple check if a page
is loaded or something? I would guess the usage is rather temporary in a
single place or just occasionally. If some user could have a reason to
save it for the entire duration of an Emacs session they could save it
in a lisp variable themselves. As now, since there is a global
reference protected from GC, in the most probable case, the list will be
left alive for the life of the session, even if they don't use it.
Anyway, thanks for the explanations.
[-- Attachment #2: Type: text/html, Size: 9596 bytes --]
prev parent reply other threads:[~2025-01-03 16:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 15:59 A possible small tiny bug in win32 FULL_DEBUG build and some questions arthur miller
2025-01-02 17:19 ` Eli Zaretskii
2025-01-03 0:24 ` Sv: " arthur miller
2025-01-03 8:32 ` Eli Zaretskii
2025-01-03 16:19 ` arthur miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AS8PR02MB101078B4311129B4A820F592796152@AS8PR02MB10107.eurprd02.prod.outlook.com \
--to=arthur.miller@live.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).