xwem-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XWEM]: OSD fun


From: Zajcev Evgeny
Subject: Re: [XWEM]: OSD fun
Date: Mon, 12 Apr 2004 09:21:54 +0400
User-agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.5 (celery, berkeley-unix)

Steve Youngs <address@hidden> writes:

> I've been playing around with xwem-osd.  Lots of fun and really cool.
> I had the current date displayed, and some hardware monitors
> displayed (CPU & case fan speeds, CPU, M/B, HDD temps etc).
>
> And then I discovered some not so nice things about xwem-osd... 
>
> Their size.  My God!  These things are *HUGE*!  Let me try to explain
> what I mean.  The OSD that I had displaying the date is in a window
> that is 100 pixels wide by 20 pixels high, it contains nothing but 11
> characters of text.  The data in that teeny weeny OSD is over 2
> million characters long!
>
> I know this because, in a scratch buffer I did...
>
> (eval 'sy-osd-date)C-j
>
> Move point to the last character of the output and...
>
> C-x =
>
> It told me that I was looking at column 2281996 
>
> Those 11 characters, "Sat, Apr 10", are chewing up 2 megabytes of
> memory.  Don't worry, this gets better.  These OSDs grow.  That number
> I quoted just before is from a little while ago, now it is 2355518.
>

Yes, that is.  osd struct is really huge for printing because it holds
X-Win struct, which for its part holds reference to X-Dpy which has
many things cached, such as atoms, colors, events(which has cross
referenco to display), etc.  But it is not really 2M in memory, they
only huge for printing.

If we will remove reference to dpy in X-Win struct than these printing
will be really small, because most of things stored in X-Dpy.
Reference was added, because in cirtain situations you have only X-Win
and no display for which X-Win was created.

> The next bad thing about OSDs is that you can't completely kill them.
> If I (xwem-osd-destroy 'sy-osd-date), the displayed text vanishes, and
> `xwem-osd-p' returns `nil', but `sy-osd-date' still contains 2 meg of
> data.
>
> I would expect that after (xwem-osd-destroy 'foo), that (eval 'foo)
> would return `nil'.  It doesn't.  I could probably add a `(setq foo
> nil)' after the call to `xwem-osd-destroy', but shouldn't xwem-osd
> take care of that?
>

Yes it is kind a problem.  Maybe adding (X-invalidate-cl-strung osd)
at the end of `xwemw-osd-destroy' will do the job, actually such call
should be done whenever performing destroing some xlib/xwem object.

> Following is some code that I've been using as a test
>
> (require 'xwem-osd)
> (defvar sy-osd-date nil)
> (copy-face 'default 'sy-osd-date-face)
> (set-face-foreground 'sy-osd-date-face "cyan")
>
> (defun sy-show-date-osd ()
>   "*Display the current date using OSD."
>   (interactive)
>   (let* ((fromleft 820)
>        (fromtop 740)
>        (face `sy-osd-date-face)
>        (text (format-time-string "%a, %b %e"))
>        (xwem-osd-always-ontop t))
>     (setq sy-osd-date (xwem-osd-create (xwem-dpy) fromleft fromtop 100 20))
>     (xwem-osd-set-color sy-osd-date (face-foreground-name face))
>     (xwem-osd-set-font sy-osd-date (face-font-name face))
>     (xwem-osd-text sy-osd-date text)
>     (xwem-osd-show sy-osd-date)))
>
> (defun sy-delete-osd-date ()
>   "*Delete the OSD date."
>   (interactive)
>   (when (xwem-osd-p sy-osd-date)
>     (xwem-osd-destroy sy-osd-date)))
>
> M-x sy-show-osd-date RET to create the OSD
>
> M-: (xwem-osd-p 'sy-osd-date) RET to confirm it really exists
>
> Then in scratch, do `(eval 'sy-osd-date)C-j'
>
> Move point the end of the output and do `C-x =', have a look at the
> column number.
>
> M-x sy-delete-osd-date RET
>
> M-: (xwem-osd-p 'sy-osd-date) RET to confirm that it has gone.
>
> in scratch, `(eval 'sy-osd-date)C-j'
>
> move point to the end of the output and `C-x =', look at the column
> number.
>
> M-x sy-show-osd-date RET
> M-x sy-delete-osd-date RET
> M-x sy-show-osd-date RET
> M-x sy-delete-osd-date RET
> M-x sy-show-osd-date RET
> M-x sy-delete-osd-date RET
> M-x sy-show-osd-date RET
> M-x sy-delete-osd-date RET
> M-x sy-show-osd-date RET
> M-x sy-delete-osd-date RET
> M-x sy-show-osd-date RET
> M-x sy-delete-osd-date RET
> M-x sy-show-osd-date RET
> M-x sy-delete-osd-date RET
> M-x sy-show-osd-date RET
> M-x sy-delete-osd-date RET
>
> in scratch, `(eval 'sy-osd-date)C-j'
>
> move point to the end of the output and `C-x =', look at the column
> number.
>
> Of course you should disregard this if my test code is bogus. :-)
>

No, no, test is ok.  It is really xwem-osd problem.  I suspect that
such problem occurs in xwem-clients and others too.

Thanks!

> -- 
> |---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
> |              Ashes to ashes, dust to dust.               |
> |      The proof of the pudding, is under the crust.       |
> |------------------------------<address@hidden>---|
> _______________________________________________
> Xwem-devel mailing list
> address@hidden
> http://mail.nongnu.org/mailman/listinfo/xwem-devel

-- 
lg




reply via email to

[Prev in Thread] Current Thread [Next in Thread]