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

Closed
m7a opened this issue Aug 5, 2020 · 6 comments

Comments

@m7a
Copy link

m7a commented Aug 5, 2020

Hello,

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 debugsc.sc
  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

Attachments

  • debugsc.sc.txt -- failing spreadsheet
  • debuglo.zip -- 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 debugsc.sc)

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

@andmarti1424
Copy link
Owner

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.

@m7a
Copy link
Author

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.
debugsc2.sc.txt

@andmarti1424
Copy link
Owner

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
@andmarti1424
Copy link
Owner

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

@m7a
Copy link
Author

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 :) .

@andmarti1424
Copy link
Owner

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
Projects
None yet
Development

No branches or pull requests

2 participants