tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

huge memory leak in work with cached images and medium leak with loading images

Open f242 opened this issue 11 years ago • 35 comments

easy to reproduce

medium leak

  1. clear cache
  2. close telegram
  3. run again
  4. open group chat with 1000-1500 posted images
  5. open task manager to see memory consumption
  6. scroll up to earlier messages

huge leak

  1. just close telegram after previous experiment (if it don't crashed lol) without clear cache
  2. open group chat with 1000-1500 posted images
  3. open task manager to see memory consumption
  4. scroll up to earlier messages

i recorded video https://files.fm/u/ynvqtnms

f242 avatar Nov 22 '15 19:11 f242

I can confirm this behaviour on telegram 0.9.19 on Linux.

sa7dse avatar Jan 22 '16 13:01 sa7dse

I can confirm too. I use Telegram 0.9.42 for Linux 64 bit downloaded from official site. But I also got confirmation from few people who uses it on Windows.

Open chat with stickers, images and other attached media files. Scroll to beginning of the chat and then to the end. Repeat several times and you could notice memory leak.

stpnk avatar Apr 27 '16 10:04 stpnk

I left Telegram-desktop opened on my always-on archlinux machine for about 10 days without even touching that machine. When i was back ,telegram was using about 2.5GB of ram and i repeat, nobody even used it. This is still valid on 0.9.56

kokoko3k avatar Jul 18 '16 17:07 kokoko3k

I used valgrind few months ago, but the amount of errors related to QT was a pain to debug properly.

Aokromes avatar Nov 08 '16 09:11 Aokromes

Telegram Desktop slowly increases it's memory usage and never seems to clear it, until restarted manually or eaten by OOM Killer.

infoman avatar May 04 '17 19:05 infoman

Hey there!

We're automatically closing this issue since there was no activity in this issue since 392 days ago. We therefore assume that the user has lost interest or resolved the problem on their own. Closed issues that remain inactive for a long period may get automatically locked.

Don't worry though; if this is in error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

(Please note that this is an automated comment.)

ghost avatar Jun 01 '18 18:06 ghost

problem is still present

f242 avatar Jun 01 '18 18:06 f242

I confirm this bug exists on 1.4 and it leads to crash on 32 bits versions.

Aokromes avatar Oct 02 '18 15:10 Aokromes

When are you fix this?

Darkcacok avatar Dec 14 '18 15:12 Darkcacok

@Darkcacok It should be better in the latest versions.

john-preston avatar Dec 14 '18 15:12 john-preston

Already 1.5 version and this bug is still not fixed on Linux. I do not know how it works in Windows, but Windows does not have the same problem

Darkcacok avatar Dec 14 '18 15:12 Darkcacok

@Darkcacok Linux and Windows versions work the same way with images and caching, so there should not be any major difference. Maybe you test them differently?

john-preston avatar Dec 14 '18 15:12 john-preston

I open the task manager on Windows and scroll through the chat. When the telegram begins to use more than 100 megabytes, the memory is reset to 50-60 megabytes. On Linux, memory does not even decrease, but only increases. What's the problem and how it is work?

Darkcacok avatar Dec 14 '18 15:12 Darkcacok

@Darkcacok Do you try 1.5.2 on Windows? It should allow up to 128 MB of image data in memory before it starts clearing, both on Windows and on Linux.

john-preston avatar Dec 14 '18 15:12 john-preston

Ok. I tried version 1.5.2 on windows. Now the memory is kept at around 200 megabytes, but it is still slowly increasing. I managed to reach 230-240 megabytes. On Linux, memory cleanup does not work at all. image

Darkcacok avatar Dec 14 '18 15:12 Darkcacok

image

Darkcacok avatar Dec 14 '18 15:12 Darkcacok

So why on Linux it does not work?

Darkcacok avatar Dec 14 '18 15:12 Darkcacok

I'm so sorry. Memory is really cleared on Linux. But not as aggressive as on Windows. I was not able to increase my memory usage by more than 1 gigabyte. Good work. But you can do better. image

Darkcacok avatar Dec 14 '18 16:12 Darkcacok

1.5.15 on Linux. Tdesktop use to eat 50-60 mb on startup but after ~24 hours memory usage increases up to 300 mb

danielleontiev avatar Mar 14 '19 09:03 danielleontiev

Man, this issue is opened for more than 3 years now. I doubt it will be solved, so i just made a script that restarts it every hour.

#!/bin/bash
while true ; do
kill `pidof telegram-desktop` && telegram-desktop -startintray &
sleep 3600
done

...and made it a systemd user service

kokoko3k avatar Mar 14 '19 09:03 kokoko3k