Menu

#760 win32job.CreateJobObject name parameter doesn't seem to work.

v1.0 (example)
closed-invalid
nobody
None
5
2018-01-02
2017-10-18
D. Adams
No

I'm new to submitting Bugs this way, so forgive me if I've done it wrong.

Using the win32job.CreateJobObject function, I've found that the second parameter (lpName, as documented here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682409(v=vs.85).aspx) doesn't seem to work. If I have two processes that call CreateJobObject with the same name (and then associate the JobObject with the process), the two processes should be associated with the same JobObject. I've not found this to be the case. I validated this by using win32job.QueryInformationJobObject(None, win32job.JobObjectExtendedLimitInformation) to check on PeakJobMemoryUsed. In each process, I have a loop printing that value, and then allocating 10MB, then sleeping again:

memory = list()
while True:
memory.append(numpy.zeros(shape=(10000000,), dtype='i1'))
extended_limit = win32job.QueryInformationJobObject(None, win32job.JobObjectExtendedLimitInformation)
print(extended_limit['PeakProcessMemoryUsed'], extended_limit['PeakJobMemoryUsed'])
time.sleep(1)

With the two jobs running this looop, I'd expect the PeakJobMemoryUsed value to increase by 20MB per second, but I only see it increase by 10MB per second. Also, if one process runs a while, then I start another, I'd expect the second to print the Peak numbers from the first rather than starting over.

Discussion

  • Mark Hammond

    Mark Hammond - 2018-01-02
    • status: open --> closed-invalid
     
  • Mark Hammond

    Mark Hammond - 2018-01-02

    We do pass the name to the win32 function, so I suspect this is either misunderstanding of how this API works.