~abcdw/rde-discuss

7 2

Memory leak when using native comp?

Demis Balbach <db@minikn.xyz>
Details
Message ID
<87v90o5tgq.fsf@minikn.xyz>
DKIM signature
pass
Download raw message
Hello,

I'd like to use flatwhatsons emacs package `emacs-pgtk-native-comp' to
make use of the native compilation functionality, so I specified it in
feature-emacs: `(feature-emacs #:package emacs-pgtk-native-comp)'.

And this works without a problem. That is, until I enable
`(feature-emacs-completion)'. When I do that really weird things start
happening. If I log out of sway and log back in and start `htop',

I can see a lot of emacs processes starting (Note: This happens without
actually starting emacs, just logging into sway). I think it's trying to
natively compile certain files. However, this will eat up all of my RAM
(32 GB) in about 2-3 minutes, rendering the machine unusuable.

Here is a screenshot: https://i.imgur.com/5nhUn4t.jpeg
This was arount 1 minute after starting sway, already 14G gone :P

The weird thing is, that I've also used `emacs-pgtk-native-comp' before
switching to rde (and also with the same completion packges) and I have
never had this issue.

So far, this only happens when enabling `feature-emacs-completion', I
also have other emacs features enabled like faces, appearance. It
doesn't happen with them. Also this happens every time, so it's
reproducable.

I also tried doing this:

---
 (feature-emacs #:package emacs-pgtk-native-comp
                 #:extra-config
                 `((include ,(local-file "./emacs/nc.el"))))
---

where `nc.el' contains

---
(setq comp-deferred-compilation-deny-list
           '("vertico" "embark" "..."))
---

But this didn't help either. I also tried searching the GitHub issue
trackers of said packages, including the emacs package, but couldn't
find any issues related to this.

If I can do anything to futher diagnose this, please let me know.

---
Best regards,

Demis Balbach
Details
Message ID
<87zgq01a7v.fsf@trop.in>
In-Reply-To
<87v90o5tgq.fsf@minikn.xyz> (view parent)
DKIM signature
missing
Download raw message
On 2021-11-19 11:29, Demis Balbach wrote:

> Hello,
>
> I'd like to use flatwhatsons emacs package `emacs-pgtk-native-comp' to
> make use of the native compilation functionality, so I specified it in
> feature-emacs: `(feature-emacs #:package emacs-pgtk-native-comp)'.
>
> And this works without a problem. That is, until I enable
> `(feature-emacs-completion)'. When I do that really weird things start
> happening. If I log out of sway and log back in and start `htop',
>
> I can see a lot of emacs processes starting (Note: This happens without
> actually starting emacs, just logging into sway). I think it's trying to
> natively compile certain files. However, this will eat up all of my RAM
> (32 GB) in about 2-3 minutes, rendering the machine unusuable.

feature-emacs extends a home-shepherd with emacs daemon.  So it starts
automatically, when shepherd starts, you can disable it. 

>
> Here is a screenshot: https://i.imgur.com/5nhUn4t.jpeg
> This was arount 1 minute after starting sway, already 14G gone :P
>
> The weird thing is, that I've also used `emacs-pgtk-native-comp' before
> switching to rde (and also with the same completion packges) and I have
> never had this issue.
>
> So far, this only happens when enabling `feature-emacs-completion', I
> also have other emacs features enabled like faces, appearance. It
> doesn't happen with them. Also this happens every time, so it's
> reproducable.

I can reproduce it, seems the problem with mini-frame package and
native-comp (maybe other packages affected too), I added #:mini-frame?
argument to feature-completion, so you can disable it if you want.

I also plan to migrate to native-comp, so I'm interested in debugging
this problem, but don't have more spare time today, will come back to
this issue next week.

>
> I also tried doing this:
>
> ---
>  (feature-emacs #:package emacs-pgtk-native-comp
>                  #:extra-config
>                  `((include ,(local-file "./emacs/nc.el"))))

Probably you are looking for load-file, there is no include function in
Emacs AFAIK.

> ---
>
> where `nc.el' contains
>
> ---
> (setq comp-deferred-compilation-deny-list
>            '("vertico" "embark" "..."))
> ---
>
> But this didn't help either. I also tried searching the GitHub issue
> trackers of said packages, including the emacs package, but couldn't
> find any issues related to this.
>
> If I can do anything to futher diagnose this, please let me know.
>
> ---
> Best regards,
>
> Demis Balbach

-- 
Best regards,
Andrew Tropin
Demis Balbach <db@minikn.xyz>
Details
Message ID
<87o86bdhgc.fsf@minikn.xyz>
In-Reply-To
<87zgq01a7v.fsf@trop.in> (view parent)
DKIM signature
pass
Download raw message
> I can reproduce it, seems the problem with mini-frame package and
> native-comp (maybe other packages affected too), I added #:mini-frame?
> argument to feature-completion, so you can disable it if you want.

> I also plan to migrate to native-comp, so I'm interested in debugging
> this problem, but don't have more spare time today, will come back to
> this issue next week.

With the additional parameter it works like a charm. Thanks!

> Probably you are looking for load-file, there is no include function in
> Emacs AFAIK.

I was infact using `load-file', I just copied the wrong snippet to the
email and didn't fix it properly.

Thank you for looking at this.
Details
Message ID
<87wnkvcefh.fsf@trop.in>
In-Reply-To
<87o86bdhgc.fsf@minikn.xyz> (view parent)
DKIM signature
missing
Download raw message
On 2021-11-22 22:10, Demis Balbach wrote:

>> I can reproduce it, seems the problem with mini-frame package and
>> native-comp (maybe other packages affected too), I added #:mini-frame?
>> argument to feature-completion, so you can disable it if you want.
>
>> I also plan to migrate to native-comp, so I'm interested in debugging
>> this problem, but don't have more spare time today, will come back to
>> this issue next week.
>
> With the additional parameter it works like a charm. Thanks!
>

Very good.

I found out that it happens with some other packages too.  I did a guix
gc, so I need to recompile Emacs again to debug it.  Probably, I will
postpose switching to native-comp again for a while and will come back
to it later.

>> Probably you are looking for load-file, there is no include function in
>> Emacs AFAIK.
>
> I was infact using `load-file', I just copied the wrong snippet to the
> email and didn't fix it properly.
>
> Thank you for looking at this.

-- 
Best regards,
Andrew Tropin
Demis Balbach <db@minikn.xyz>
Details
Message ID
<877dcspenh.fsf@minikn.xyz>
In-Reply-To
<87zgq01a7v.fsf@trop.in> (view parent)
DKIM signature
pass
Download raw message
Hello,

I noticed this also happens with `emacs-evil' and/or
`emacs-evil-collection'.

For now, I switched back to the default emacs package.

Do you know why this only happens with RDE? At least as far as I can
tell it has never happened to me before using RDE (with the same
packages).


--
Best regards,

Demis Balbach.
Details
Message ID
<87a6hnfhzk.fsf@trop.in>
In-Reply-To
<877dcspenh.fsf@minikn.xyz> (view parent)
DKIM signature
missing
Download raw message
On 2021-11-28 14:56, Demis Balbach wrote:

> Hello,
>
> I noticed this also happens with `emacs-evil' and/or
> `emacs-evil-collection'.
>
> For now, I switched back to the default emacs package.
>
> Do you know why this only happens with RDE? At least as far as I can
> tell it has never happened to me before using RDE (with the same
> packages).

The only difference from default setup is that rde configurations are
packages and they get processed with emacs-build-system, by default elc
files are build with emacs27, maybe it can cause problems in some cases.

There is rebuild-emacs-packages? flag for emacs home service, which
updates all packages using emacs build system and makes them use version
of emacs specified in service config.  However, this feature was failing
for some packages, dash.el IIRC.  Maintaners of the package fixed it,
but I didn't try to re-enable rebuild-emacs-packages? for a while, maybe
now it works as expected.  Theoretically it can solve the issue or not
(:

It's just a guess, maybe the reason is different.

-- 
Best regards,
Andrew Tropin
Details
Message ID
<8735mv4lnm.fsf@trop.in>
In-Reply-To
<877dcspenh.fsf@minikn.xyz> (view parent)
DKIM signature
missing
Download raw message
On 2021-11-28 14:56, Demis Balbach wrote:

> Hello,
>
> I noticed this also happens with `emacs-evil' and/or
> `emacs-evil-collection'.
>
> For now, I switched back to the default emacs package.
>
> Do you know why this only happens with RDE? At least as far as I can
> tell it has never happened to me before using RDE (with the same
> packages).
>
>
> --
> Best regards,
>
> Demis Balbach.

There is another hypothesis:
It can happen cause of low gc threshold defined in early-init.

-- 
Best regards,
Andrew Tropin
Details
Message ID
<87o859dd4t.fsf@trop.in>
In-Reply-To
<8735mv4lnm.fsf@trop.in> (view parent)
DKIM signature
missing
Download raw message
On 2021-12-14 11:48, Andrew Tropin wrote:

> On 2021-11-28 14:56, Demis Balbach wrote:
>
>> Hello,
>>
>> I noticed this also happens with `emacs-evil' and/or
>> `emacs-evil-collection'.
>>
>> For now, I switched back to the default emacs package.
>>
>> Do you know why this only happens with RDE? At least as far as I can
>> tell it has never happened to me before using RDE (with the same
>> packages).
>>
>>
>> --
>> Best regards,
>>
>> Demis Balbach.
>
> There is another hypothesis:
> It can happen cause of low gc threshold defined in early-init.

I built emacs-pgtk-native-comp and it just works.

There is a small issue: now packages got native-compiled, when loaded
for the first time, in the future I plan to make it possible to native
compile them during reconfigure so no "runtime native compilation" will
happen.  Will need to revisit rebuild-elisp-packages implementation to
make sure it works correctly.

-- 
Best regards,
Andrew Tropin
Reply to thread Export thread (mbox)