Skip to content
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

Large increase in memory use upon paste and delete operations in certain spreadsheets #433

m7a opened this issue Aug 5, 2020 · 6 comments


Copy link

m7a commented Aug 5, 2020


I have found a memory-management issue but could not get my head around debugging it completely.

Here is how to reproduce it:

  1. $ sc-im
  2. go to G1
  3. visual mark G1:G20
  4. y
  5. goto H1
  6. Pc
  7. Got: Large increase in memory use (from 5 MiB to ~ 2 GiB), sc-im becomes unresponsive.
    Expected: Program responds immediately

Note: When saving the changes and opening the changed file, memory use is down to 5 MiB again... until one attempts to delete the newly added cells. If doing this with visual select and then x, memory use will again increase to around 2 GiB...

My local configuration (~/.config/scimrc) has this (but the problem seems to appear without any scimrc, too):

set autocalc

Memory profiler screenshot


  • -- failing spreadsheet
  • -- same sheet in LibreOffice
    (does not exhibit excessive memory usage, thus it should not be the computation's problem)
  • massif.out.1307.txt -- memory profiler data
    (obtained through valgrind --tool=massif --heap=yes --stacks=yes ./sc-im

System data:

  • git commit a4abe78
  • Debian 10 GNU/Linux 4.19.0-9-amd64
  • gcc version 8.3.0 (Debian 8.3.0-6)

I appreciate it very much if someone more knowledgeable of the source code could check this issue?

Thanks in advance

Copy link

andmarti1424 commented Aug 6, 2020

Thanks for reporting this. This is interesting. It shows that maybe the undo feature is not handled at it should when altering extensive number of cells.

Copy link

m7a commented Aug 6, 2020

I can add that at least from the user's perspective it does not only occur when copying multiple cells at once: In the attached spreadsheet, if one goes to H19, yy, j, Pc then it also increases memory usage quite a lot (around 800M). It seems less the number of cells being copied than how the computation is linked. In my sample spreadsheet, computation depends on another cell which in turn depends on another cell etc. It seems to me that this linking of the cell's computations somehow causes the large memory use.

Copy link

andmarti1424 commented Mar 23, 2021

This froze my linux machine.
Without UNDO works ok. The problem, as you said, seems to be when having multiple cells links one to another and making any kind of change. There's something wrong when preparing the undo structure.

andmarti1424 added a commit that referenced this issue Mar 23, 2021
Copy link

andmarti1424 commented Mar 23, 2021

@m7a made some changes. Please feel free to update to update to latest commit and try this again. Thanks.

Copy link

m7a commented Mar 23, 2021

I can confirm that the issue is resolved in 66e87b0. Thank you very much for the fix! From my point of view, the issue can be closed :) .

Copy link

andmarti1424 commented Mar 23, 2021

Thank you for your time and research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants