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, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to