So on my laptop the other day, I noticed Yi had spiked to 60% of my RAM (512MB 
machine), which perplexed me as I was only doing some IReader stuff and each 
text is no more than a book (1MB?) and usually less.

A little thought and I decided that this must be due to the undo history, since 
I could undo each update, and if the text of each and every book I was going 
through was being held...

While it's fine to have undo within each text, I don't want undos from update 
to update and especially not if it means horrific memory usage; thus, my 
'setDisplayedArticle' (which calls 'replaceBufferContent' to actually update 
the buffer) ought to delete the undo history.

Grepping and looking at Yi.Buffer.Misc, it seems that the undo history is 
probably being stored as 'undos :: !URList' in the Attributes type. The whole 
system is something of a mystery to me, but looking at the code C-/ is bound 
to, I think the way to update the undo list is to modify the little BufferM do 
expression in setDisplayedArticle to call 'putA undosA emptyU' at the end? eg.

hunk ./src/Yi/IReader.hs 19
-import Yi.Buffer.Misc (bufferDynamicValueA, BufferM)
+import Yi.Buffer.Misc -- (bufferDynamicValueA, BufferM)
hunk ./src/Yi/IReader.hs 25
+import Yi.Buffer.Undo
hunk ./src/Yi/IReader.hs 93
+                                               -- erase undo history
+                                               putA undosA emptyU


(I'd test this myself, but I can't seem to compile yi because the Template Haskell 
errors out with 'Loading package gtk-0.10.0 ... <command line>: can't load 
.so/.DLL for: gdk_pixbuf-2.0 (libgdk_pixbuf-2.0.so: cannot open shared object file: 
No such file or directory)', and there apparently *is* no -dev package for pixbuf2 in 
Ubuntu; even more confusingly, I do have a /usr/lib/libgdk_pixbuf-2.0.so.0, a 
/usr/lib/libgdk_pixbuf.so, and a /usr/lib/libgdk_pixbuf.so.2.0.0 among others. I 
guess they're not right.)

--
gwern

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to