Tkinter uses a lot of memory?!
Paul Clinch
pclinch at internet-glue.co.uk
Mon Nov 17 16:27:47 EST 2003
servantofthesecretfire at fea.st (ServantOfTheSecretFire) wrote in message news:<f2adc03e.0311162026.3c282ccf at posting.google.com>...
> Hi there,
>
> I wrote my first Python program this weekend, Conway's Game of Life,
> and I used Tkinter for the graphics. I thought I had done something
> wrong when I saw the memory consumption, so I wrote the simplest Tk
> program I could, and yep, it takes about 40MB of memory! I'm using Red
> Hat Linux 9.0 and recent versions of the software. Please look at the
> output below, and tell me if I am confused...
Wow!
> ~/python: cat /etc/redhat-release
> Red Hat Linux release 9 (Shrike)
>
Suse 8.2
> ~/python: rpmquery python
> python-2.2.2-26
>
rpm -qf $(which python)
python-2.2.2-82
> ~/python: rpmquery tk
> tk-8.3.5-88
>
rpm -q tk
tk-8.4.2-27
> ~/python: rpmquery tkinter
> tkinter-2.2.2-26
>
rpm -q python-tk
python-tk-2.2.2-92
> ~/python: cat hello.py
> #!/usr/bin/python
> import Tkinter as Tk
> root = Tk.Tk()
> Tk.Button(text='Quit', command=root.quit).pack()
> root.mainloop()
>
> ~/python: python hello.py &
> [1] 25633
>
> ~/python: ps u
> USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
> sjm 23897 0.0 0.2 4980 1088 pts/0 S 12:18 0:00 -csh
> sjm 25633 4.8 7.2 41576 37352 pts/0 S 22:35 0:00 python
> hello.py
pac 2947 1.6 2.1 11216 5556 pts/1 S 21:24 0:00 python
> sjm 25634 0.0 0.1 2616 660 pts/0 R 22:35 0:00 ps u
I suppose all can suggest is that you do a lsof | grep sjm and spent
some time working out what shared libraries have been pulled in.
Regards, Paul Clinch
More information about the Python-list
mailing list