[python-win32] win32job.SetInformtionJobObject usage -- what am I doing wrong?

Bob Erb rerb at progress.com
Tue May 26 18:28:04 CEST 2009


Hi.

I want to create a Win32 job, then limit its memory use.  I thought
the code below would work, but it doesn't.  What am I doing wrong?

#<code>

import win32job
import win32security

security_attrs = win32security.SECURITY_ATTRIBUTES()

job = win32job.CreateJobObject(security_attrs, 'test job')

extended_limits = win32job.QueryInformationJobObject(
	job, win32job.JobObjectExtendedLimitInformation)

extended_limits['JobMemoryLimit'] = 4123123123

win32job.SetInformationJobObject(job,
								 win32job.JobObjectExtendedLimitInformation,
								 extended_limits)

print extended_limits['JobMemoryLimit']

print win32job.QueryInformationJobObject(
	job, win32job.JobObjectExtendedLimitInformation)['JobMemoryLimit']

#</code>

Output is:

       4123123123
       0

The job's JobMemoryLimit isn't changed.

Hope you can help.

Thank you.

- Bob


More information about the python-win32 mailing list