Tkinter uses a lot of memory?!

  • Thread starter ServantOfTheSecretFire
  • Start date
S

ServantOfTheSecretFire

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...

~/python: cat /etc/redhat-release
Red Hat Linux release 9 (Shrike)

~/python: rpmquery python
python-2.2.2-26

~/python: rpmquery tk
tk-8.3.5-88

~/python: rpmquery tkinter
tkinter-2.2.2-26

~/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
sjm 25634 0.0 0.1 2616 660 pts/0 R 22:35 0:00 ps u
 
I

Ivan Voras

ServantOfTheSecretFire said:
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...
sjm 25633 4.8 7.2 41576 37352 pts/0 S 22:35 0:00 python


Can't say about linux, but on windows your program takes about 5.5MB.
 
P

Paul Clinch

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top