-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
w3mimgdisplay consumes a lot of memory #451
Comments
Yep, it keeps a cache. I think this should really be fixed in w3m rather than in ranger. :S |
Add -gtk flag to w3m if using gentoo, this fixed it for me. |
Thanks, fixed consumtion. |
Since I don't have a gentoo at hands just now, I had a look at what the -gtk USE flag does: |
No you need opposite without gtk but with imlib2. Try --with-imagelib=imlib2 |
That's what I had before, still the same issue. |
Tried different options, did not work for me. When only imlib2 is set, it crashes and nothing renders in ranger. CPPFLAGS="-D_FORTIFY_SOURCE=2" |
I'll include the full configure from my gentoo installation. Maybe this will help You somehow? ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --libdir=/usr/lib64 --with-editor=/usr/bin/vi --with-mailer=/bin/mail --with-browser=/usr/bin/xdg-open --with-termlib=yes --enable-image=x11,fb --with-imagelib=imlib2 --with-migemo=no --enable-m17n --enable-unicode --enable-mouse --enable-nls --disable-nntp --enable-digest-auth --with-ssl --disable-xface --enable-japanese=U --enable-keymap=w3m |
Oh, and BTW, from
|
Hmm... Tried your exact same 'configure' (although I've never really trusted autoconf), and _FORTIFY_SOURCE=1, I am still experiencing the same leak. Problem might be with imlib then. Or something else. |
These issues should be reported upstream in |
Well this is very easy to fix on ranger... Here's a patch (for ext/img_display.py from ranger-stable 1.8.1). You just kill w3mimgdisplay after drawing the image and fork it again when drawing another... The delay between drawing an image and another is the same for me with the current version of ranger and with the patch. There is no noticeable overhead from the fork on my system. This is kind of a workaround, so how to fix it on w3m... If anyone is interested I report an attempt below, with no success. @mrogalski I'm assuming you're using the latest version of w3m (0.5.3 from 2011)? I'm on Gentoo too and I have the same useflags that you except for
Notice that besides the Japanese stuff (migemo is related to that) and the disabling of mouse support the sole difference is There are several entries on w3m's Changelog related to image caching. The code is not very well documented, so I recompiled w3m with debug info and modified ranger to run massif when calling w3mimgdisplay:
Here's a profile. Of course one can run w3mimgdisplay directly with valgrind, passing the correct format strings, but ranger does that for us. Anyway, I'm not sure if the issue is a memory leak or if it's intentional caching... I tried to fix memory leaks but that didn't help. I only report it so other people don't waste time as well: It seems that x11_w3mimg is opening an X display but never closing it (see the profile above). I tried implementing
It seems that the relevant leak occurs at:
See here for the full output. Though |
I too am making RAM cakes with w3m... dir of 50 images eats 1.5 Gig I'm trying to apply the patch suggested by afarah1, but I'm not sure how to insert the "self.quit()" line are we looking at the lines in ext/img_display.py
? where do I insert the patch? |
--- ranger/ext/img_display.py.old 2017-08-28 15:57:15.651869415 +0300
+++ ranger/ext/img_display.py 2017-08-28 15:59:41.258670713 +0300
@@ -106,6 +106,8 @@
start_y, width, height))
self.process.stdin.flush()
self.process.stdout.readline()
+ self.quit()
+ self.is_initialized = False
def clear(self, start_x, start_y, width, height):
if not self.is_initialized or self.process.poll() is not None: for 1.8.1 |
@dquinton just add the two lines at the end of the |
Can't you guys use the above patch? Hacks to work around bugs in the libraries are ok. As long as you keep them well documented and easily removable. Maybe have a runtime/config option to activate them. I see quite a few "not our bug" |
PRs will be considered. We'd really rather prefer you switch to ueberzug though. That method has proved a lot more stable than w3mimgpreview. |
After scrolling a 20-30 images it consumes up to 2gb+ memory.
Related https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=218857
The text was updated successfully, but these errors were encountered: