https://bugs.documentfoundation.org/show_bug.cgi?id=158914

--- Comment #14 from Patrick Luby (volunteer) <guibomac...@gmail.com> ---
(In reply to Michael Weghorn from comment #10)
> I remember Noel fixed some Calc memory leak last year (see commit
> 8e886993f32b7db11a99bdecf06451e6de6c3842 ), but at least that fix was
> already included in daily builds last December (already tested according to
> comment 2).
> Apart from that, I don't have any ideas right now without doing further
> analysis.

So I added the following debug patch to see if there was any ScAccessibleCell
were never getting deleted. The good news is that when you close a Calc
document, the number of undeleted ScAccessibleCell instances goes back down to
zero.

But what I found interesting is that while VoiceOver is enabled, clicking on a
cell causes roughly 2K new ScAccessibleCell instances to be allocated. A few of
those instances gets deleted very soon after it is allocated, but all the rest
are cached somewhere until the Calc document is closed.

So, the next thing to investigate is which code is requesting so many new
ScAccessibleCell instances for each cell:

diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx
b/sc/source/ui/Accessibility/AccessibleCell.cxx
index b27fbb90671a..0d6beafa37c8 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -49,6 +49,8 @@
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;

+static std::map<ScAccessibleCell*, ScAccessibleCell*> aAccessibleCellMap;
+
 rtl::Reference<ScAccessibleCell> ScAccessibleCell::create(
         const uno::Reference<XAccessible>& rxParent,
         ScTabViewShell* pViewShell,
@@ -79,10 +81,15 @@ ScAccessibleCell::ScAccessibleCell(
 {
     if (pViewShell)
         pViewShell->AddAccessibilityObject(*this);
+aAccessibleCellMap[this] = this;
 }

 ScAccessibleCell::~ScAccessibleCell()
 {
+std::map<ScAccessibleCell*, ScAccessibleCell*>::iterator it =
aAccessibleCellMap.find(this);
+if (it != aAccessibleCellMap.end())
+aAccessibleCellMap.erase(it);
+fprintf(stderr, "ScAccessibleCell count; %lu\n", aAccessibleCellMap.size());
     if (!ScAccessibleContextBase::IsDefunc() && !rBHelper.bInDispose)
     {
         // increment refcount to prevent double call off dtor

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to