VAN0 Posted September 26, 2022 Share Posted September 26, 2022 While investigating an issue with StdoutRead(), I came across a strange thing, every time StdoutRead() is used it increases number of handles: #include <Misc.au3> While 1 Local $iPID = Run(@ComSpec & " /c WMIC PROCESS WHERE Name='autoit3.exe' GET handlecount", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($iPID) Local $sOut = StdoutRead($iPID) StdioClose($iPID) ConsoleWrite("out=" & StringStripWS($sOut, 4) & @CRLF) Sleep(1000) WEnd The number increases based on number of channels. In this example there are two channels $STDERR_CHILD and $STDOUT_CHILD so it increases by 2 The memory usage doesn't increase, just the handle count. Is this supposed to be like this? Shouldn't StdioClose() clean up or something? Link to comment Share on other sites More sharing options...
rudi Posted October 31, 2022 Share Posted October 31, 2022 Hi, I came across the increasing handle count before, but as you mentioned already, a Stdioclose($PID) is cleaning that up. On my system I cannot confirm, that it's increasing by the time: >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\temp\test.au3" /UserParams +>15:19:35 Starting AutoIt3Wrapper v.18.708.1148.0 SciTE v.4.1.0.0 Keyboard:00000407 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0407) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\admin.AD\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\admin.AD\AppData\Local\AutoIt v3\SciTE +>Check for missing standard constants/udf include files: 1 include(s) were added >Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\temp\test.au3 +>15:19:36 AU3Check ended.rc:0 >Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\temp\test.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop out=HandleCount 331 193 165 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 out=HandleCount 331 193 164 >Process failed to respond; forcing abrupt termination... >Exit code: 1 Time: 31.04 Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Nine Posted October 31, 2022 Share Posted October 31, 2022 (edited) @VAN0 I get the same result as you on Win7 (3.3.16.1). After looking a little deeper on it, any kind of run (even a simple dir) will increase the number of handles. Edit : if you use $STDOUT_CHILD or $STDERR_MERGED only, the increase is only one. So it seems related to the stream. Might be worth asking the dev ( @jpm @Jos ) Edited October 31, 2022 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now