New submission from Yang Big <qq519476...@gmail.com>: Here my code: 2 import sys 3 import ctypes 4 5 6 def hi(): 7 class timespec(ctypes.Structure): 8 ┆ """Time specification, as described in clock_gettime(3).""" 9 ┆ _fields_ = (('tv_sec', ctypes.c_long), 10 ┆ ┆ ┆ ┆ ('tv_nsec', ctypes.c_long)) 11 12 13 ts = timespec() 14 po = ctypes.pointer(ts) 15 16 17 def main(): 18 while True: 19 ┆ test = hi() 20 21 if __name__ == "__main__": 22 sys 2 import sys 3 import ctypes 4 5 6 def hi(): 7 class timespec(ctypes.Structure): 8 ┆ """Time specification, as described in clock_gettime(3).""" 9 ┆ _fields_ = (('tv_sec', ctypes.c_long), 10 ┆ ┆ ┆ ┆ ('tv_nsec', ctypes.c_long)) 11 12 13 ts = timespec() 14 po = ctypes.pointer(ts) 15 16 17 def main(): 18 while True: 19 ┆ test = hi() 20 21 if __name__ == "__main__": 22 sys.exit(main())
run this code, i find that the program occupy more and more VmRss my python is 2.7.11, in python3 i also find this problem. Is this normal?I am a newbie with python, not very familiar with some python's internal principle. Tanks. ---------- components: ctypes messages: 305204 nosy: Yang Big, amaury.forgeotdarc, belopolsky, meador.inge priority: normal severity: normal status: open title: In function define class inherit ctypes.structure, and using ctypes.pointer leak memory type: resource usage versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31896> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com