This gives a dramatic improvement in memory usage for me, with at least one
107 MB log file constantly being written to.
xemacs-packages/erc/ChangeLog addition:
2009-07-22 Aidan Kehoe <kehoea(a)parhasard.net>
* erc-log.el (erc-log-setup-logging):
Don't insert the entire log file into the buffer if
erc-truncate-buffer is in erc-insert-post-hook (even though most
of the buffer is later deleted in this case); avoids XEmacs
keeping lots of memory around needlessly when log files are huge
but buffer sizes are tiny. GNU Emacs doesn't do this, but it
should be a win there too, there's no need to create a 100 MB
buffer needlessly.
XEmacs Packages (existing ChangeLogs) source patch:
Diff command: cvs -q diff -Nu
Files affected: xemacs-packages/erc/erc-log.el
Index: xemacs-packages/erc/erc-log.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/erc/erc-log.el,v
retrieving revision 1.10
diff -u -r1.10 erc-log.el
--- xemacs-packages/erc/erc-log.el 2008/07/23 07:23:12 1.10
+++ xemacs-packages/erc/erc-log.el 2009/07/22 10:39:43
@@ -230,9 +230,17 @@
(set (make-local-variable 'write-file-hooks)
'(erc-save-buffer-in-logs))))
(when erc-log-insert-log-on-open
- (ignore-errors (insert-file-contents (erc-current-logfile))
- (move-marker erc-last-saved-position
- (1- (point-max)))))))
+ (let* ((log-file (erc-current-logfile))
+ (log-file-size (nth 7 (file-attributes log-file)))
+ (start (if (and log-file-size
+ (memq 'erc-truncate-buffer
+ erc-insert-post-hook))
+ (- log-file-size erc-max-buffer-size)
+ 0)))
+ (ignore-errors (insert-file-contents log-file nil start
+ log-file-size))
+ (move-marker erc-last-saved-position
+ (1- (point-max)))))))
;;; Append, so that 'erc-initialize-log-marker keeps running first.
(add-hook 'erc-connect-pre-hook 'erc-log-setup-logging 'append)
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghe, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches