Issue27371
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2016-06-22 21:01 by jeremyblow, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (5) | |||
---|---|---|---|
msg269086 - (view) | Author: Jeremy Blow (jeremyblow) | Date: 2016-06-22 21:01 | |
Hi folks, While going about running tkinter's update() call within a coroutine/asyncio event loop in lieu of using mainloop(), I came across odd memory behavior on MacOS where the cpython process gradually increases memory consumption. Suspicious that there may be some unfavorable interaction between asyncio's use of KqueueSelector and the lower level tk calls, I stripped things down to a simple implementation and found the behavior exhibits itself without asyncio involved at all. ``` import tkinter as tk def start(root): while True: root.update() # tk update loop: mem consumption increases start(tk.Tk()) # tk mainloop: mem consumption stable # tk.Tk().mainloop() ``` # Using tk mainloop, ~1 minute /Users/jeremy$ /usr/bin/time -l python3.5 tk_perf.py 60.26 real 0.16 user 0.07 sys 31756288 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 10215 page reclaims 0 page faults 0 swaps 0 block input operations 7 block output operations 0 messages sent 0 messages received 0 signals received 7 voluntary context switches 1788 involuntary context switches # tk update loop, ~1 minute /Users/jeremy$ /usr/bin/time -l python3.5 tk_perf.py Traceback (most recent call last): File "tk_perf.py", line 10, in <module> start(tk.Tk()) File "tk_perf.py", line 7, in start root.update() File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/tkinter/__init__.py", line 1025, in update self.tk.call('update') _tkinter.TclError: can't invoke "update" command: application has been destroyed 60.37 real 38.09 user 20.54 sys 545976320 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 135760 page reclaims 2 page faults 0 swaps 0 block input operations 9 block output operations 0 messages sent 0 messages received 0 signals received 474742 voluntary context switches 1672276 involuntary context switches That's 31,756,288 versus 545,976,320 after ~1 minute. If I let the update loop continue, it eventually consumes many gigabytes of memory. Obviously something is very wrong here. To further the fun, I've tested this across three Macs, and only two exhibit the behavior. This may or may not be interesting to those who are already aware of Tk / Cocoa event loop interaction issues. +---------------+----------------+----------------+----------+ | MacOS Version | Python Version | Tcl/Tk Version | Exhibits | +---------------+----------------+----------------+----------+ | 10.11.3/15D21 | 3.5.1 | 8.5/8.5 | Yes | | 10.9.4/13E28 | 3.5.1 | 8.5/8.5 | No | | 10.11.2/15C50 | 3.5.1 | 8.5/8.5 | Yes | +---------------+----------------+----------------+----------+ Could someone illuminate me as to as whether I'm facing a PEBKAC, update() is lacking some housekeeping that exists in the mainloop routine, a new/known bug, or other? Further troubleshooting steps I can take are appreciated, I'm happy to try to isolate it further. My use case is a tkinter app written solely w/ coroutines thus the event loop selection is constrained. Env details below.. Cheers. ~~~ENV~~~~ /Users/jeremy$ sw_vers ProductName: Mac OS X ProductVersion: 10.11.3 BuildVersion: 15D21 /Users/jeremy$ python3.5 --version Python 3.5.1 >>> import _tkinter >>> _tkinter.__spec__ ModuleSpec(name='_tkinter', loader=<_frozen_importlib_external.ExtensionFileLoader object at 0x1028ae5c0>, origin='/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload/_tkinter.cpython-35m-darwin.so') >>> _tkinter.TCL_VERSION, _tkinter.TK_VERSION ('8.5', '8.5') /Users/jeremy$ python3.5 -m sysconfig "sysconfig.get_config_vars()" Platform: "macosx-10.11-x86_64" Python version: "3.5" Current installation scheme: "posix_prefix" Paths: data = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" include = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" platinclude = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" platlib = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages" platstdlib = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" purelib = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages" scripts = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin" stdlib = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" Variables: ABIFLAGS = "m" AC_APPLE_UNIVERSAL_BUILD = "0" AIX_GENUINE_CPLUSPLUS = "0" AR = "ar" ARFLAGS = "rc" ASDLGEN = "python ./Parser/asdl_c.py" ASDLGEN_FILES = "./Parser/asdl.py ./Parser/asdl_c.py" AST_ASDL = "./Parser/Python.asdl" AST_C = "Python/Python-ast.c" AST_C_DIR = "Python" AST_H = "Include/Python-ast.h" AST_H_DIR = "Include" BASECFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic" BASECPPFLAGS = "" BASEMODLIBS = "" BINDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin" BINLIBDEST = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" BLDLIBRARY = "" BLDSHARED = "clang -bundle -undefined dynamic_lookup" BUILDEXE = ".exe" BUILDPYTHON = "python.exe" BUILD_GNU_TYPE = "x86_64-apple-darwin15.4.0" BYTESTR_DEPS = "\" CC = "clang" CCSHARED = "" CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes" CFLAGSFORSHARED = "" CFLAGS_NODIST = "" CONFIGFILES = "configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in" CONFIGURE_CFLAGS = "" CONFIGURE_CFLAGS_NODIST = "-Werror=declaration-after-statement" CONFIGURE_CPPFLAGS = "" CONFIGURE_LDFLAGS = "" CONFIG_ARGS = "'--prefix=/usr/local/Cellar/python3/3.5.1' '--enable-ipv6' '--datarootdir=/usr/local/Cellar/python3/3.5.1/share' '--datadir=/usr/local/Cellar/python3/3.5.1/share' '--enable-framework=/usr/local/Cellar/python3/3.5.1/Frameworks' '--without-ensurepip' '--without-gcc' 'MACOSX_DEPLOYMENT_TARGET=10.11' 'CC=clang' 'PKG_CONFIG_PATH=/usr/local/opt/xz/lib/pkgconfig:/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig' 'PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.11'" CONFINCLUDEDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include" CONFINCLUDEPY = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" COREPYTHONPATH = ":plat-darwin" COVERAGE_INFO = "/private/tmp/python320160418-12904-1t6reri/Python-3.5.1/coverage.info" COVERAGE_REPORT = "/private/tmp/python320160418-12904-1t6reri/Python-3.5.1/lcov-report" COVERAGE_REPORT_OPTIONS = "--no-branch-coverage --title "CPython lcov report"" CPPFLAGS = "-I. -IInclude -I./Include" CXX = "clang++" DESTDIRS = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5 /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5 /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload" DESTLIB = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" DESTPATH = "" DESTSHARED = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/lib-dynload" DIRMODE = "755" DIST = "README ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in Include Lib Misc Ext-dummy" DISTDIRS = "Include Lib Misc Ext-dummy" DISTFILES = "README ChangeLog configure configure.ac acconfig.h pyconfig.h.in Makefile.pre.in" DLINCLDIR = "." DLLLIBRARY = "" DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 = "0" DOUBLE_IS_BIG_ENDIAN_IEEE754 = "0" DOUBLE_IS_LITTLE_ENDIAN_IEEE754 = "1" DYNLOADFILE = "dynload_shlib.o" ENABLE_IPV6 = "1" ENSUREPIP = "no" EXE = "" EXEMODE = "755" EXTRAMACHDEPPATH = "" EXTRATESTOPTS = "" EXTRA_CFLAGS = "" EXT_SUFFIX = ".cpython-35m-darwin.so" FILEMODE = "644" FLOCK_NEEDS_LIBBSD = "0" GETPGRP_HAVE_ARG = "0" GETTIMEOFDAY_NO_TZ = "0" GNULD = "no" GRAMMAR_C = "Python/graminit.c" GRAMMAR_H = "Include/graminit.h" GRAMMAR_INPUT = "./Grammar/Grammar" HAVE_ACCEPT4 = "0" HAVE_ACOSH = "1" HAVE_ADDRINFO = "1" HAVE_ALARM = "1" HAVE_ALIGNED_REQUIRED = "0" HAVE_ALLOCA_H = "1" HAVE_ALTZONE = "0" HAVE_ASINH = "1" HAVE_ASM_TYPES_H = "0" HAVE_ATANH = "1" HAVE_BIND_TEXTDOMAIN_CODESET = "0" HAVE_BLUETOOTH_BLUETOOTH_H = "0" HAVE_BLUETOOTH_H = "0" HAVE_BROKEN_MBSTOWCS = "0" HAVE_BROKEN_NICE = "0" HAVE_BROKEN_PIPE_BUF = "0" HAVE_BROKEN_POLL = "0" HAVE_BROKEN_POSIX_SEMAPHORES = "0" HAVE_BROKEN_PTHREAD_SIGMASK = "0" HAVE_BROKEN_SEM_GETVALUE = "1" HAVE_BROKEN_UNSETENV = "0" HAVE_BUILTIN_ATOMIC = "1" HAVE_C99_BOOL = "1" HAVE_CHFLAGS = "1" HAVE_CHOWN = "1" HAVE_CHROOT = "1" HAVE_CLOCK = "1" HAVE_CLOCK_GETRES = "0" HAVE_CLOCK_GETTIME = "0" HAVE_COMPUTED_GOTOS = "1" HAVE_CONFSTR = "1" HAVE_CONIO_H = "0" HAVE_COPYSIGN = "1" HAVE_CTERMID = "1" HAVE_CTERMID_R = "1" HAVE_CURSES_H = "1" HAVE_CURSES_IS_TERM_RESIZED = "1" HAVE_CURSES_RESIZETERM = "1" HAVE_CURSES_RESIZE_TERM = "1" HAVE_DECL_ISFINITE = "1" HAVE_DECL_ISINF = "1" HAVE_DECL_ISNAN = "1" HAVE_DECL_TZNAME = "0" HAVE_DEVICE_MACROS = "1" HAVE_DEV_PTC = "0" HAVE_DEV_PTMX = "1" HAVE_DIRECT_H = "0" HAVE_DIRENT_D_TYPE = "1" HAVE_DIRENT_H = "1" HAVE_DIRFD = "1" HAVE_DLFCN_H = "1" HAVE_DLOPEN = "1" HAVE_DUP2 = "1" HAVE_DUP3 = "0" HAVE_DYNAMIC_LOADING = "1" HAVE_ENDIAN_H = "0" HAVE_EPOLL = "0" HAVE_EPOLL_CREATE1 = "0" HAVE_ERF = "1" HAVE_ERFC = "1" HAVE_ERRNO_H = "1" HAVE_EXECV = "1" HAVE_EXPM1 = "1" HAVE_FACCESSAT = "1" HAVE_FCHDIR = "1" HAVE_FCHMOD = "1" HAVE_FCHMODAT = "1" HAVE_FCHOWN = "1" HAVE_FCHOWNAT = "1" HAVE_FCNTL_H = "1" HAVE_FDATASYNC = "0" HAVE_FDOPENDIR = "1" HAVE_FEXECVE = "0" HAVE_FINITE = "1" HAVE_FLOCK = "1" HAVE_FORK = "1" HAVE_FORKPTY = "1" HAVE_FPATHCONF = "1" HAVE_FSEEK64 = "0" HAVE_FSEEKO = "1" HAVE_FSTATAT = "1" HAVE_FSTATVFS = "1" HAVE_FSYNC = "1" HAVE_FTELL64 = "0" HAVE_FTELLO = "1" HAVE_FTIME = "1" HAVE_FTRUNCATE = "1" HAVE_FUTIMENS = "0" HAVE_FUTIMES = "1" HAVE_FUTIMESAT = "0" HAVE_GAI_STRERROR = "1" HAVE_GAMMA = "1" HAVE_GCC_ASM_FOR_MC68881 = "0" HAVE_GCC_ASM_FOR_X64 = "1" HAVE_GCC_ASM_FOR_X87 = "1" HAVE_GCC_UINT128_T = "1" HAVE_GETADDRINFO = "1" HAVE_GETC_UNLOCKED = "1" HAVE_GETENTROPY = "0" HAVE_GETGROUPLIST = "1" HAVE_GETGROUPS = "1" HAVE_GETHOSTBYNAME = "1" HAVE_GETHOSTBYNAME_R = "0" HAVE_GETHOSTBYNAME_R_3_ARG = "0" HAVE_GETHOSTBYNAME_R_5_ARG = "0" HAVE_GETHOSTBYNAME_R_6_ARG = "0" HAVE_GETITIMER = "1" HAVE_GETLOADAVG = "1" HAVE_GETLOGIN = "1" HAVE_GETNAMEINFO = "1" HAVE_GETPAGESIZE = "1" HAVE_GETPEERNAME = "1" HAVE_GETPGID = "1" HAVE_GETPGRP = "1" HAVE_GETPID = "1" HAVE_GETPRIORITY = "1" HAVE_GETPWENT = "1" HAVE_GETRANDOM = "0" HAVE_GETRANDOM_SYSCALL = "0" HAVE_GETRESGID = "0" HAVE_GETRESUID = "0" HAVE_GETSID = "1" HAVE_GETSPENT = "0" HAVE_GETSPNAM = "0" HAVE_GETTIMEOFDAY = "1" HAVE_GETWD = "1" HAVE_GLIBC_MEMMOVE_BUG = "0" HAVE_GRP_H = "1" HAVE_HSTRERROR = "1" HAVE_HTOLE64 = "0" HAVE_HYPOT = "1" HAVE_IEEEFP_H = "0" HAVE_IF_NAMEINDEX = "1" HAVE_INET_ATON = "1" HAVE_INET_PTON = "1" HAVE_INITGROUPS = "1" HAVE_INT32_T = "1" HAVE_INT64_T = "1" HAVE_INTTYPES_H = "1" HAVE_IO_H = "0" HAVE_IPA_PURE_CONST_BUG = "0" HAVE_KILL = "1" HAVE_KILLPG = "1" HAVE_KQUEUE = "1" HAVE_LANGINFO_H = "1" HAVE_LARGEFILE_SUPPORT = "0" HAVE_LCHFLAGS = "1" HAVE_LCHMOD = "1" HAVE_LCHOWN = "1" HAVE_LGAMMA = "1" HAVE_LIBDL = "1" HAVE_LIBDLD = "0" HAVE_LIBIEEE = "0" HAVE_LIBINTL_H = "0" HAVE_LIBREADLINE = "1" HAVE_LIBRESOLV = "0" HAVE_LIBSENDFILE = "0" HAVE_LIBUTIL_H = "0" HAVE_LINK = "1" HAVE_LINKAT = "1" HAVE_LINUX_CAN_BCM_H = "0" HAVE_LINUX_CAN_H = "0" HAVE_LINUX_CAN_RAW_FD_FRAMES = "0" HAVE_LINUX_CAN_RAW_H = "0" HAVE_LINUX_NETLINK_H = "0" HAVE_LINUX_TIPC_H = "0" HAVE_LOCKF = "1" HAVE_LOG1P = "1" HAVE_LOG2 = "1" HAVE_LONG_DOUBLE = "1" HAVE_LONG_LONG = "1" HAVE_LSTAT = "1" HAVE_LUTIMES = "1" HAVE_MAKEDEV = "1" HAVE_MBRTOWC = "1" HAVE_MEMMOVE = "1" HAVE_MEMORY_H = "1" HAVE_MEMRCHR = "0" HAVE_MKDIRAT = "1" HAVE_MKFIFO = "1" HAVE_MKFIFOAT = "0" HAVE_MKNOD = "1" HAVE_MKNODAT = "0" HAVE_MKTIME = "1" HAVE_MMAP = "1" HAVE_MREMAP = "0" HAVE_NCURSES_H = "1" HAVE_NDIR_H = "0" HAVE_NETPACKET_PACKET_H = "0" HAVE_NET_IF_H = "1" HAVE_NICE = "1" HAVE_OPENAT = "1" HAVE_OPENPTY = "1" HAVE_OSX105_SDK = "1" HAVE_PATHCONF = "1" HAVE_PAUSE = "1" HAVE_PIPE2 = "0" HAVE_PLOCK = "0" HAVE_POLL = "1" HAVE_POLL_H = "1" HAVE_POSIX_FADVISE = "0" HAVE_POSIX_FALLOCATE = "0" HAVE_PREAD = "1" HAVE_PRLIMIT = "0" HAVE_PROCESS_H = "0" HAVE_PROTOTYPES = "1" HAVE_PTHREAD_ATFORK = "1" HAVE_PTHREAD_DESTRUCTOR = "0" HAVE_PTHREAD_H = "1" HAVE_PTHREAD_INIT = "0" HAVE_PTHREAD_KILL = "1" HAVE_PTHREAD_SIGMASK = "1" HAVE_PTY_H = "0" HAVE_PUTENV = "1" HAVE_PWRITE = "1" HAVE_RAND_EGD = "1" HAVE_READLINK = "1" HAVE_READLINKAT = "1" HAVE_READV = "1" HAVE_REALPATH = "1" HAVE_RENAMEAT = "1" HAVE_RL_APPEND_HISTORY = "1" HAVE_RL_CALLBACK = "1" HAVE_RL_CATCH_SIGNAL = "1" HAVE_RL_COMPLETION_APPEND_CHARACTER = "1" HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK = "1" HAVE_RL_COMPLETION_MATCHES = "1" HAVE_RL_COMPLETION_SUPPRESS_APPEND = "1" HAVE_RL_PRE_INPUT_HOOK = "1" HAVE_ROUND = "1" HAVE_SCHED_GET_PRIORITY_MAX = "1" HAVE_SCHED_H = "1" HAVE_SCHED_RR_GET_INTERVAL = "0" HAVE_SCHED_SETAFFINITY = "0" HAVE_SCHED_SETPARAM = "0" HAVE_SCHED_SETSCHEDULER = "0" HAVE_SELECT = "1" HAVE_SEM_GETVALUE = "1" HAVE_SEM_OPEN = "1" HAVE_SEM_TIMEDWAIT = "0" HAVE_SEM_UNLINK = "1" HAVE_SENDFILE = "1" HAVE_SETEGID = "1" HAVE_SETEUID = "1" HAVE_SETGID = "1" HAVE_SETGROUPS = "1" HAVE_SETHOSTNAME = "1" HAVE_SETITIMER = "1" HAVE_SETLOCALE = "1" HAVE_SETPGID = "1" HAVE_SETPGRP = "1" HAVE_SETPRIORITY = "1" HAVE_SETREGID = "1" HAVE_SETRESGID = "0" HAVE_SETRESUID = "0" HAVE_SETREUID = "1" HAVE_SETSID = "1" HAVE_SETUID = "1" HAVE_SETVBUF = "1" HAVE_SHADOW_H = "0" HAVE_SIGACTION = "1" HAVE_SIGALTSTACK = "1" HAVE_SIGINTERRUPT = "1" HAVE_SIGNAL_H = "1" HAVE_SIGPENDING = "1" HAVE_SIGRELSE = "1" HAVE_SIGTIMEDWAIT = "0" HAVE_SIGWAIT = "1" HAVE_SIGWAITINFO = "0" HAVE_SNPRINTF = "1" HAVE_SOCKADDR_SA_LEN = "1" HAVE_SOCKADDR_STORAGE = "1" HAVE_SOCKETPAIR = "1" HAVE_SPAWN_H = "1" HAVE_SSIZE_T = "1" HAVE_STATVFS = "1" HAVE_STAT_TV_NSEC = "0" HAVE_STAT_TV_NSEC2 = "1" HAVE_STDARG_PROTOTYPES = "1" HAVE_STDINT_H = "1" HAVE_STDLIB_H = "1" HAVE_STD_ATOMIC = "0" HAVE_STRDUP = "1" HAVE_STRFTIME = "1" HAVE_STRINGS_H = "1" HAVE_STRING_H = "1" HAVE_STRLCPY = "1" HAVE_STROPTS_H = "0" HAVE_STRUCT_STAT_ST_BIRTHTIME = "1" HAVE_STRUCT_STAT_ST_BLKSIZE = "1" HAVE_STRUCT_STAT_ST_BLOCKS = "1" HAVE_STRUCT_STAT_ST_FLAGS = "1" HAVE_STRUCT_STAT_ST_GEN = "1" HAVE_STRUCT_STAT_ST_RDEV = "1" HAVE_STRUCT_TM_TM_ZONE = "1" HAVE_ST_BLOCKS = "1" HAVE_SYMLINK = "1" HAVE_SYMLINKAT = "1" HAVE_SYNC = "1" HAVE_SYSCONF = "1" HAVE_SYSEXITS_H = "1" HAVE_SYS_AUDIOIO_H = "0" HAVE_SYS_BSDTTY_H = "0" HAVE_SYS_DEVPOLL_H = "0" HAVE_SYS_DIR_H = "0" HAVE_SYS_ENDIAN_H = "0" HAVE_SYS_EPOLL_H = "0" HAVE_SYS_EVENT_H = "1" HAVE_SYS_FILE_H = "1" HAVE_SYS_IOCTL_H = "1" HAVE_SYS_KERN_CONTROL_H = "1" HAVE_SYS_LOADAVG_H = "0" HAVE_SYS_LOCK_H = "1" HAVE_SYS_MKDEV_H = "0" HAVE_SYS_MODEM_H = "0" HAVE_SYS_NDIR_H = "0" HAVE_SYS_PARAM_H = "1" HAVE_SYS_POLL_H = "1" HAVE_SYS_RESOURCE_H = "1" HAVE_SYS_SELECT_H = "1" HAVE_SYS_SENDFILE_H = "0" HAVE_SYS_SOCKET_H = "1" HAVE_SYS_STATVFS_H = "1" HAVE_SYS_STAT_H = "1" HAVE_SYS_SYSCALL_H = "1" HAVE_SYS_SYS_DOMAIN_H = "1" HAVE_SYS_TERMIO_H = "0" HAVE_SYS_TIMES_H = "1" HAVE_SYS_TIME_H = "1" HAVE_SYS_TYPES_H = "1" HAVE_SYS_UIO_H = "1" HAVE_SYS_UN_H = "1" HAVE_SYS_UTSNAME_H = "1" HAVE_SYS_WAIT_H = "1" HAVE_SYS_XATTR_H = "1" HAVE_TCGETPGRP = "1" HAVE_TCSETPGRP = "1" HAVE_TEMPNAM = "1" HAVE_TERMIOS_H = "1" HAVE_TERM_H = "1" HAVE_TGAMMA = "1" HAVE_TIMEGM = "1" HAVE_TIMES = "1" HAVE_TMPFILE = "1" HAVE_TMPNAM = "1" HAVE_TMPNAM_R = "0" HAVE_TM_ZONE = "1" HAVE_TRUNCATE = "1" HAVE_TZNAME = "0" HAVE_UCS4_TCL = "0" HAVE_UINT32_T = "1" HAVE_UINT64_T = "1" HAVE_UINTPTR_T = "1" HAVE_UNAME = "1" HAVE_UNISTD_H = "1" HAVE_UNLINKAT = "1" HAVE_UNSETENV = "1" HAVE_USABLE_WCHAR_T = "0" HAVE_UTIL_H = "1" HAVE_UTIMENSAT = "0" HAVE_UTIMES = "1" HAVE_UTIME_H = "1" HAVE_WAIT3 = "1" HAVE_WAIT4 = "1" HAVE_WAITID = "1" HAVE_WAITPID = "1" HAVE_WCHAR_H = "1" HAVE_WCSCOLL = "1" HAVE_WCSFTIME = "1" HAVE_WCSXFRM = "1" HAVE_WMEMCMP = "1" HAVE_WORKING_TZSET = "1" HAVE_WRITEV = "1" HAVE_ZLIB_COPY = "1" HAVE__GETPTY = "0" HGBRANCH = "" HGTAG = "" HGVERSION = "" HOST_GNU_TYPE = "x86_64-apple-darwin15.4.0" INCLDIRSTOMAKE = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m /usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" INCLUDEDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include" INCLUDEPY = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m" INSTALL = "/usr/bin/install -c" INSTALL_DATA = "/usr/bin/install -c -m 644" INSTALL_PROGRAM = "/usr/bin/install -c" INSTALL_SCRIPT = "/usr/bin/install -c" INSTALL_SHARED = "/usr/bin/install -c -m 555" INSTSONAME = "Python.framework/Versions/3.5/Python" IO_H = "Modules/_io/_iomodule.h" IO_OBJS = "\" LDCXXSHARED = "clang++ -bundle -undefined dynamic_lookup" LDFLAGS = "" LDLAST = "" LDLIBRARY = "Python.framework/Versions/3.5/Python" LDLIBRARYDIR = "" LDSHARED = "clang -bundle -undefined dynamic_lookup" LDVERSION = "3.5m" LIBC = "" LIBDEST = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" LIBDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib" LIBFFI_INCLUDEDIR = "" LIBM = "" LIBOBJDIR = "Python/" LIBOBJS = "" LIBPC = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/pkgconfig" LIBPL = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m" LIBRARY = "libpython3.5m.a" LIBRARY_OBJS = "\" LIBRARY_OBJS_OMIT_FROZEN = "\" LIBS = "-ldl -framework CoreFoundation" LIBSUBDIRS = "tkinter tkinter/test tkinter/test/test_tkinter \" LINKCC = "clang" LINKFORSHARED = "-Wl,-stack_size,1000000 -framework CoreFoundation Python.framework/Versions/3.5/Python" LIPO_32BIT_FLAGS = "" LLVM_PROF_ERR = "yes" LLVM_PROF_FILE = "LLVM_PROFILE_FILE="code-%p.profclangr"" LLVM_PROF_MERGER = "llvm-profdata merge -output=code.profclangd *.profclangr" LN = "ln" LOCALMODLIBS = "" LOG1P_DROPS_ZERO_SIGN = "0" MACHDEP = "darwin" MACHDEPPATH = ":plat-darwin" MACHDEPS = "plat-darwin" MACHDEP_OBJS = "" MACHDESTLIB = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5" MACOSX_DEPLOYMENT_TARGET = "10.11" MAINCC = "clang" MAJOR_IN_MKDEV = "0" MAJOR_IN_SYSMACROS = "0" MAKESETUP = "./Modules/makesetup" MANDIR = "/usr/local/Cellar/python3/3.5.1/share/man" MKDIR_P = "./install-sh -c -d" MODLIBS = "" MODOBJS = "Modules/_threadmodule.o Modules/signalmodule.o Modules/posixmodule.o Modules/errnomodule.o Modules/pwdmodule.o Modules/_sre.o Modules/_codecsmodule.o Modules/_weakref.o Modules/_functoolsmodule.o Modules/_operator.o Modules/_collectionsmodule.o Modules/itertoolsmodule.o Modules/atexitmodule.o Modules/_stat.o Modules/timemodule.o Modules/_localemodule.o Modules/_iomodule.o Modules/iobase.o Modules/fileio.o Modules/bytesio.o Modules/bufferedio.o Modules/textio.o Modules/stringio.o Modules/zipimport.o Modules/faulthandler.o Modules/_tracemalloc.o Modules/hashtable.o Modules/symtablemodule.o Modules/xxsubtype.o" MODULE_OBJS = "\" MULTIARCH = "" MVWDELCH_IS_EXPRESSION = "1" NO_AS_NEEDED = "" OBJECT_OBJS = "\" OPCODETARGETGEN = "\" OPCODETARGETGEN_FILES = "\" OPCODETARGETS_H = "\" OPCODE_H = "./Include/opcode.h" OPCODE_H_DIR = "./Include" OPCODE_H_GEN = "python ./Tools/scripts/generate_opcode_h.py ./Lib/opcode.py ./Include/opcode.h" OPCODE_H_SCRIPT = "./Tools/scripts/generate_opcode_h.py" OPT = "-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes" OTHER_LIBTOOL_OPT = "" PACKAGE_BUGREPORT = "0" PACKAGE_NAME = "0" PACKAGE_STRING = "0" PACKAGE_TARNAME = "0" PACKAGE_URL = "0" PACKAGE_VERSION = "0" PARSER_HEADERS = "\" PARSER_OBJS = "\ Parser/myreadline.o Parser/parsetok.o Parser/tokenizer.o" PGEN = "Parser/pgen" PGENOBJS = "\ \" PGENSRCS = "\ \" PGOBJS = "\" PGO_PROF_GEN_FLAG = "-fprofile-instr-generate" PGO_PROF_USE_FLAG = "-fprofile-instr-use=code.profclangd" PGSRCS = "\" PLATDIR = "plat-darwin" POBJS = "\" POSIX_SEMAPHORES_NOT_ENABLED = "0" PROFILE_TASK = "-m test.regrtest --pgo" PSRCS = "\" PTHREAD_SYSTEM_SCHED_SUPPORTED = "1" PURIFY = "" PY3LIBRARY = "" PYLONG_BITS_IN_DIGIT = "0" PYTHON = "python" PYTHONFRAMEWORK = "Python" PYTHONFRAMEWORKDIR = "Python.framework" PYTHONFRAMEWORKINSTALLDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework" PYTHONFRAMEWORKPREFIX = "/usr/local/Cellar/python3/3.5.1/Frameworks" PYTHONPATH = ":plat-darwin" PYTHON_FOR_BUILD = "./python.exe -E" PYTHON_HEADERS = "\" PYTHON_OBJS = "\" PY_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes" PY_CFLAGS_NODIST = "-Werror=declaration-after-statement" PY_CORE_CFLAGS = "-Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Werror=declaration-after-statement -I. -IInclude -I./Include -DPy_BUILD_CORE" PY_CPPFLAGS = "-I. -IInclude -I./Include" PY_FORMAT_LONG_LONG = ""ll"" PY_FORMAT_SIZE_T = ""z"" PY_LDFLAGS = "" Py_DEBUG = "0" Py_ENABLE_SHARED = "0" Py_HASH_ALGORITHM = "0" QUICKTESTOPTS = "-x test_subprocess test_io test_lib2to3 \" RANLIB = "ranlib" READELF = ":" RESSRCDIR = "Mac/Resources/framework" RETSIGTYPE = "void" RUNSHARED = "DYLD_FRAMEWORK_PATH=/private/tmp/python320160418-12904-1t6reri/Python-3.5.1" SCRIPTDIR = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib" SETPGRP_HAVE_ARG = "0" SGI_ABI = "" SHELL = "/bin/sh" SHLIBS = "-ldl -framework CoreFoundation" SHLIB_SUFFIX = ".so" SIGNAL_OBJS = "" SIGNED_RIGHT_SHIFT_ZERO_FILLS = "0" SITEPATH = "" SIZEOF_DOUBLE = "8" SIZEOF_FLOAT = "4" SIZEOF_FPOS_T = "8" SIZEOF_INT = "4" SIZEOF_LONG = "8" SIZEOF_LONG_DOUBLE = "16" SIZEOF_LONG_LONG = "8" SIZEOF_OFF_T = "8" SIZEOF_PID_T = "4" SIZEOF_PTHREAD_T = "8" SIZEOF_SHORT = "2" SIZEOF_SIZE_T = "8" SIZEOF_TIME_T = "8" SIZEOF_UINTPTR_T = "8" SIZEOF_VOID_P = "8" SIZEOF_WCHAR_T = "4" SIZEOF__BOOL = "1" SO = ".cpython-35m-darwin.so" SOABI = "cpython-35m-darwin" SRCDIRS = "Parser Grammar Objects Python Modules Mac Programs" SRC_GDB_HOOKS = "./Tools/gdb/libpython.py" STDC_HEADERS = "1" STRICT_SYSV_CURSES = "/* Don't use ncurses extensions */" STRIPFLAG = "-s" SUBDIRS = "" SUBDIRSTOO = "Include Lib Misc" SYSLIBS = "" SYS_SELECT_WITH_SYS_TIME = "1" TANH_PRESERVES_ZERO_SIGN = "1" TCLTK_INCLUDES = "" TCLTK_LIBS = "" TESTOPTS = "" TESTPATH = "" TESTPYTHON = "DYLD_FRAMEWORK_PATH=/private/tmp/python320160418-12904-1t6reri/Python-3.5.1 ./python.exe" TESTPYTHONOPTS = "" TESTRUNNER = "DYLD_FRAMEWORK_PATH=/private/tmp/python320160418-12904-1t6reri/Python-3.5.1 ./python.exe ./Tools/scripts/run_tests.py" TESTTIMEOUT = "3600" THREADOBJ = "Python/thread.o" TIMEMODULE_LIB = "0" TIME_WITH_SYS_TIME = "1" TM_IN_SYS_TIME = "0" UNICODE_DEPS = "\" UNIVERSALSDK = "" USE_COMPUTED_GOTOS = "0" USE_INLINE = "1" VA_LIST_IS_ARRAY = "1" VERSION = "3.5" WANT_SIGFPE_HANDLER = "0" WINDOW_HAS_FLAGS = "0" WITH_DOC_STRINGS = "1" WITH_DYLD = "1" WITH_LIBINTL = "0" WITH_NEXT_FRAMEWORK = "1" WITH_PYMALLOC = "1" WITH_THREAD = "1" WITH_TSC = "0" WITH_VALGRIND = "0" X87_DOUBLE_ROUNDING = "0" XMLLIBSUBDIRS = "xml xml/dom xml/etree xml/parsers xml/sax" abiflags = "m" abs_builddir = "/private/tmp/python320160418-12904-1t6reri/Python-3.5.1" abs_srcdir = "/private/tmp/python320160418-12904-1t6reri/Python-3.5.1" base = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" datarootdir = "/usr/local/Cellar/python3/3.5.1/share" exec_prefix = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" installed_base = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" installed_platbase = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" platbase = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" prefix = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5" projectbase = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/bin" py_version = "3.5.1" py_version_nodot = "35" py_version_short = "3.5" srcdir = "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/config-3.5m" userbase = "/Users/jeremy/Library/Python/3.5" |
|||
msg269145 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2016-06-23 21:40 | |
You might want to try stripping it further, and see if you can reproduce it just using tk, without python involved. |
|||
msg269146 - (view) | Author: Jeremy Blow (jeremyblow) | Date: 2016-06-23 21:43 | |
That seems like a good idea, will do so and report back findings. Hey, good meeting you at PyCon, by the way. Met you at the freelance open space. :-) |
|||
msg269157 - (view) | Author: Jeremy Blow (jeremyblow) | Date: 2016-06-24 05:36 | |
Confirmed the problem is with Tk/MacOS. Running a simple TCL script yielded the same behavior in terms of memory. The hunt goes elsewhere... Thank you R. David for the suggestion. ``` package require Tk while 1 { update } ``` # MacOS 10.9.4 /Users/jeremy$ /usr/bin/time -l tclsh update_loop.tcl 60.20 real 34.67 user 21.42 sys 18219008 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 5836 page reclaims 26 page faults 0 swaps 0 block input operations 9 block output operations 0 messages sent 0 messages received 0 signals received 830419 voluntary context switches 1663224 involuntary context switches # MacOS 10.11.3 /Users/jeremy$ /usr/bin/time -l tclsh update_loop.tcl 60.44 real 39.06 user 21.45 sys 571715584 maximum resident set size 0 average shared memory size 0 average unshared data size 0 average unshared stack size 141633 page reclaims 0 page faults 0 swaps 0 block input operations 3 block output operations 0 messages sent 0 messages received 0 signals received 521744 voluntary context switches 1833399 involuntary context switches |
|||
msg269197 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2016-06-24 17:18 | |
Could you please file a report on Tk bugtracker? https://core.tcl.tk/tk/ticket |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:32 | admin | set | github: 71558 |
2016-06-24 17:18:12 | serhiy.storchaka | set | messages: + msg269197 |
2016-06-24 14:41:08 | r.david.murray | set | stage: resolved |
2016-06-24 05:36:13 | jeremyblow | set | status: open -> closed resolution: third party messages: + msg269157 |
2016-06-23 21:43:04 | jeremyblow | set | messages: + msg269146 |
2016-06-23 21:40:16 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg269145 title: Runaway memory consumption using update() -> Runaway memory consumption using tkinter update() |
2016-06-23 08:21:31 | SilentGhost | set | nosy:
+ gpolo, serhiy.storchaka |
2016-06-22 21:01:29 | jeremyblow | create |