Issue31896
Created on 2017-10-30 03:53 by Yang Big, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg305204 - (view) | Author: Yang Big (Yang Big) | Date: 2017-10-30 03:53 | |
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.
|
|||
| msg305508 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2017-11-03 20:57 | |
The tracker is for patching CPython. Please consider closing this and asking your question on python-list. When you post code, do so only once, and without line numbers, so it can be copied and run as is. Do include data on the ref leaks. |
|||
| msg305854 - (view) | Author: Berker Peksag (berker.peksag) * ![]() |
Date: 2017-11-08 15:08 | |
I agree with Terry. Your code calls hi() in an infinite loop (why timespec is defined in hi()?), we don't know how clock_gettime(3) is implemented etc. (it should cleanup its own memory if it calls malloc()) etc. Please use python-list or StackOverflow for usage questions. |
|||
| msg305855 - (view) | Author: Berker Peksag (berker.peksag) * ![]() |
Date: 2017-11-08 15:15 | |
See also issue 12998. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:53 | admin | set | github: 76077 |
| 2017-11-08 15:15:20 | berker.peksag | set | messages: + msg305855 |
| 2017-11-08 15:08:59 | berker.peksag | set | status: open -> closed nosy:
+ berker.peksag resolution: not a bug |
| 2017-11-03 20:57:01 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg305508 |
| 2017-10-30 03:53:39 | Yang Big | create | |
