I've looked through the GTK2 API, and I've poked around in this forum, but I'll 
be stuffed if I can find a way to figure out aproximately how much memory the 
text in a GtkTextBuffer is taking up.

I'm storing a log file, and it's almost all ASCII, so the byte and character 
counts should be almost the same, except for the two tags and the occasional 
marker (I'm not sure whether they take up space in the text buffer or not...).

The short of it is that I'd like to keep the log trimmed to roughly a set size 
(3KB at present, but I'll be increasing that drastically -- perhaps even into 
the range of a few 100's of KB's).  The log comes in chunks, so before each 
chunk, I drop a mark (which is appended to a GSList).  I also check the size of 
the buffer (currently in characters), and while it's over the limit I delete 
everything up to the first mark (which is taken off the GSList), and check 
again.  (The buffer will sit at just a little over-size)

As I said, I'm currently working on a character count, which should be pretty 
close to the mark.  However, I'd prefer to use the number of bytes worth of 
visible text, but failing that, the number of bytes of used space in the buffer.

Anyone have any suggestions?


Fredderic

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to