Understanding HandleCount in python [closed]
I was trying to understand handles and handle count in python.
I opened a file with python and was expecting the handle count to increase since the file is still open. But the handle count remained the same.
C:\Users\achakravarthy>py Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import os os.getppid() 12688 PS C:\Users\achakravarthy> get-process -id 12688 | select-object Handle, HandleCount
Handle HandleCount
5116 142 I opened a file and wrote a text. The file is still open. I was expecting the handle count to increase to 143 since the process still has the file open.
f = open( 'test.txt', 'w+' ) f.write('hello world') 11 But HandleCount remains the same (142). The handle value was however changing randomly.
PS C:\Users\achakravarthy> get-process -id 12688 | select-object Handle, HandleCount
Handle HandleCount
1528 142 Can someone please help understand/educate with resources on why handlecount does not increase on opening a file and why handle value keeps changing randomly.
This question is a pure Python question and is not related to ROS in any way. I'd recommend asking this in a more appropriate place such as https://stackoverflow.com/