Bug 314900

Summary: Huge memory usage just for the calendar
Product: [Frameworks and Libraries] Akonadi Reporter: Alexandre Bonneau <alexandre.bonneau>
Component: ICal file resourceAssignee: Sergio Martins <smartins>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: auxsvr, mhlavink, smartins, third-impact
Priority: NOR    
Version: 4.10   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Global memory usage
Detailed memory usage for korgac
Detailed memory usage for akonadi_kcal_ressource
Detailed memory usage for korganizer

Description Alexandre Bonneau 2013-02-11 13:58:49 UTC
At all time, I have 1,5 GiB of memory used for korganizer, korgac and akonadi_kcal_resource processes, and only 40 MiB of it is shared.

The breakdown is as follow :
Process # Memory # Shared memory
korganizer # 546,5 MiB # 38,7 MiB
akonadi_kcal_resource # 538,3 MiB # 2,8 MiB
korgac # 469,9 MiB # 5,1 MiB

Reproducible: Always

Steps to Reproduce:
1. Just launch a new session, with korganizer
2. I do have events and tasks since 2005, but even uncompressed, it shouldn't take more than 8 MiB as text !


Expected Results:  
Don't use that much memory, or at least share between those 3 processes
Comment 1 Alexandre Bonneau 2013-02-11 13:59:50 UTC
Created attachment 77130 [details]
Global memory usage
Comment 2 Alexandre Bonneau 2013-02-11 14:00:27 UTC
Created attachment 77131 [details]
Detailed memory usage for korgac
Comment 3 Alexandre Bonneau 2013-02-11 14:01:06 UTC
Created attachment 77132 [details]
Detailed memory usage for akonadi_kcal_ressource
Comment 4 Alexandre Bonneau 2013-02-11 14:01:33 UTC
Created attachment 77133 [details]
Detailed memory usage for korganizer
Comment 5 Gauss 2013-03-12 13:29:19 UTC
I can confirm this bug for KDE 4.10.1 on Kubuntu 12.10.

The memory usage is ridiculously high for the calendar components.
The akonadi_kcal_resources of which I have 8 use between 40MB-230 MB, together 670MB + korgac ~450 MB, resulting in 1120 MB just for calendar components.
Comment 6 Sergio Martins 2013-06-04 22:45:51 UTC
Can you try with ical calendars instead?

(akonadi_ical_resource, not akonadi_kcal_resource)
Comment 7 Alexandre Bonneau 2013-06-05 23:35:17 UTC
I've switched to Kde 4.10.3 and ical resource since creating this bug report.
The problem still exists with this one, although it uses a bit less memory.

The memory consumption :
Process # Memory # Shared memory
korganizer # 586,3 MiB # 55,2 MiB
akonadi_ical_resource # 337,3 MiB # 23,7 MiB
korgac # 448,1 MiB # 14,3 MiB

still 1,371 GiB of memory used for 14514 calendar items (26,4 MiB in akonadiconsole).
Comment 8 Sergio Martins 2013-06-05 23:42:17 UTC
Can you run it on massif ?

valgrind --tool=massif korganizer --nofork

wait for memory increase

exit korganizer

give me the generated file ( shouldn't have any personal information )

I need debug symbols for this
Comment 9 Sergio Martins 2013-06-27 07:10:21 UTC
Would be great to get another massif report, this time with the to-do list closed, both the sidepane one, and the main one
Comment 10 Sergio Martins 2013-07-09 16:58:49 UTC
Lets continue this after you have 4.11.

A lot has changed.
Comment 11 Alexandre Bonneau 2013-07-11 09:59:14 UTC
ok sure
Comment 12 Michal Hlavinka 2013-07-12 07:15:28 UTC
Same problem here.
Machine with 12 GB RAM. From 'top':
%MEM     COMMAND
44.0  /usr/bin/akonadi_kcal_resource --identifier akonadi_kcal_resource_3
32.3  /usr/bin/korgac --icon korgac

sum=76.3 % ~ 9.15 GB RAM just for a calendar. This is overnight result. A few minutes after execution it's just 1.2 and 0.9 %.

kdepim 4.10.4
It was happening on my old system and it's happening on newly reinstalled system with clean ~/.kde this time. So this should not be caused by old configuration/data.
Comment 13 Sergio Martins 2013-07-12 07:21:08 UTC
(In reply to comment #12)
> kdepim 4.10.4
> It was happening on my old system and it's happening on newly reinstalled
> system with clean ~/.kde this time. So this should not be caused by old
> configuration/data.

can you try with the ical resource instead of the kcal_resource ? kcal is kind of deprecated
Comment 14 Michal Hlavinka 2013-07-12 09:05:45 UTC
Thanks. I just removed old calendar, added new ical calendar and restarted everything. I'll see the result on Monday.
Comment 15 Michal Hlavinka 2013-07-15 14:43:47 UTC
(In reply to comment #13)
> can you try with the ical resource instead of the kcal_resource ? kcal is
> kind of deprecated

ical seems to work fine. Thanks
Comment 16 Sergio Martins 2013-12-06 10:11:14 UTC
Fixing as wontfix, since it's a problem with the kcal resource, which is deprecated
Comment 17 Alexandre Bonneau 2013-12-18 11:46:33 UTC
(In reply to comment #16)
> Fixing as wontfix, since it's a problem with the kcal resource, which is
> deprecated

This doesn't concerns only kcal anymore, since my last comment #7 :
(In reply to comment #7)
> I've switched to Kde 4.10.3 and ical resource since creating this bug report.
> The problem still exists with this one, although it uses a bit less memory.
> 
> The memory consumption :
> Process # Memory # Shared memory
> korganizer # 586,3 MiB # 55,2 MiB
> akonadi_ical_resource # 337,3 MiB # 23,7 MiB
> korgac # 448,1 MiB # 14,3 MiB
> 
> still 1,371 GiB of memory used for 14514 calendar items (26,4 MiB in
> akonadiconsole).

The problem _still_ exists, and although it's less important than with kcal resource, ical and specifically korgac memory consumption is still too high for netbooks for instance.

Here is my updated memory consumption using 4.11.2 :
Process | Memory | Shared memory | Virtual Memory
korganizer | 487.7 M | 31.0 M | 1.2 G
akonadi_ical_resource_1 | 5.0 M | 12.7 M | 308.4 M
akonadi_ical_resource_2 | 126.7 M | 13.5 M | 448.6 M
==> korgac | 469.0 M | 15.1 M | 1.0 G <==

I think this bug shouldn't be closed, since the total memory usage for a single calendar is still huge (more than 1,088 GiB) for a 6.7 MiB ics file.
Comment 18 Sergio Martins 2013-12-18 13:58:24 UTC
Can you open a separate bug report ? the kcal leak is a different bug than the ical one
Comment 19 Alexandre Bonneau 2013-12-24 16:19:47 UTC
New bug opened here : bug 329205.