[python-win32] win32job.SetInformtionJobObject usage -- what am I doing wrong?
Tim Roberts
timr at probo.com
Tue May 26 19:49:23 CEST 2009
Bob Erb wrote:
> 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)
>
You also need this before the Set call:
extended_limits['BasicLimitInformation']['Limit_Flags'] +=
win32job.JOB_OBJECT_LIMIT_JOB_MEMORY
What do you plan to do with this? In 20 years of Windows programming,
I've never once used the Job APIs.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list