I have found a memory-management issue but could not get my head around debugging it completely.
Here is how to reproduce it:
$ sc-im debugsc.sc
go to G1
visual mark G1:G20
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):
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
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.