Jump to content

About ProcessClose


Recommended Posts

When the function process close is used, does it clean up the resources of any child processes

which might be owned by the passed process?

I'm asking as I've been using Tesseract.exe, and making a number of calls to a function using it

quite rapidly (usually between 6 and 12 calls) using ShellExecute. EDIT: ShellExecuteWait

After a few calls usually either 6,7 or 8 the process takes about 4 times the time to complete than

previous calls, and I suspect some resources are not being cleaned up, so have been using ProcessClose

in an attempt to release any memory or other resources after each call.

These attempts as you might have gathered have not been successful.

A bit more info... a usual call will take around 300 milliseconds, then the following one call might take 3000 milliseconds, or two calls will take 1500 milliseconds each, amounting to around 3000.

EDIT: After that they go back to the normal 300 ms

If I sleep 500 milliseconds between each call the are all around 300 milliseconds to complete.

I'm after any suggestions of things to try.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • 2 weeks later...

According to AutoIt 3.1.0 sources ProcessClose uses TerminateProcess API function

http://msdn.microsoft.com/en-us/library/windows/desktop/ms686714%28v=vs.85%29.aspx

See Remarks section ... I think it may be what you are after

This function stops execution of all threads within the process and requests cancellation of all pending I/O. The terminated process cannot exit until all pending I/O has been completed or canceled. When a process terminates, its kernel object is not destroyed until all processes that have open handles to the process have released those handles.

TerminateProcess is asynchronous; it initiates termination and returns immediately. If you need to be sure the process has terminated, call the WaitForSingleObject function with a handle to the process.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...