User Tools

Site Tools


The client uses too much memory

If you think the client is using too much memory, you may think there is a memory leak. But before you report a bug, consider the following common causes of high memory usage, and ways to reduce usage.

* A window that is in scrollback mode does not trim its scrollback – it will grow without any limit. A busy channel can use a lot of memory in a couple of days if you forget you're in scrollback. * A window that has an extremely large scrollback (10,000 lines). Each scrollback entry holds one physical line of display, which might average about 40 characters, so that's up to 400k per window. * A window that has an extremely large lastlog (5,000 lines). Each lastlog entry holds one logical line iof display, which can be of any size. An average size might be about 50 characters, so that's up to 250k per window. * A lot of windows are open. Even if the lastlog and scrollback sizes are modest, if you have a lot of windows open (over 20), it can add up fast. * A lot of aliases and assigns. Your script has to be loaded into memory as a text file, and is pretty much stored as text. So if your script is 150k, the client will grow by at least that much. * A lot of channels. The client keeps track of every channel you are on, and the nicknames of all of the people on those channels, and their userhosts. A channel with 50 people would take about 5k of memory. If you're joining 100 channels on 12 servers… * A lot of servers. An entry in the server list takes about 16k of memory.

Unfortunately, reducing memory usage will not usually reduce the amount of memory reported in 'top' or 'ps' because in most unix libc's, malloc()ed memory that is free()d is saved for re-use and is not returned to the operating system. But that is not so bad, because the operating system is smart, and memory that is allocated but unused will be paged out.

memory_usage.txt · Last modified: 2008/07/28 05:14 (external edit)