Closed BurdetteLamar closed 12 years ago
The problem appears when :hwnd is used as a locator since current code will search for windows by increasing :index. Since hwnd is unique then always the same window is found and the code stays at endless loop. Same thing happens with :pid.
There should be some check against :hwnd and :pid to break that loop.
To correct the original issue title - it is not a memory leak, but rather an endless loop. I'd classify memory leak as a working code, but just leaking memory. In this case code is not working since it will stay computing forever :)
I should have said that memory use increases without bound, not that there's a memory leak. Thanks.
not allowing :pid and :hwnd for searching collections: https://github.com/jarmo/RAutomation/commit/4eea1c09d31efcecde9e8f803d71467eaf3feaf6
Hi Jarmo,
My wife and I leave within the hour for a 2-week trip to India.
I'm marking the two emails ass unread, and will reply when we return.
Thanks, Burdette
From: Jarmo Pertman reply@reply.github.com To: Burdette Lamar BurdetteLamar@Yahoo.com Sent: Saturday, October 8, 2011 5:27 AM Subject: Re: [RAutomation] Windows#size can hang and leak memory (#2)
not allowing :pid and :hwnd for searching collections: https://github.com/jarmo/RAutomation/commit/4eea1c09d31efcecde9e8f803d71467eaf3feaf6
Reply to this email directly or view it on GitHub: https://github.com/jarmo/RAutomation/issues/2#issuecomment-2331447
The code below, placed in a file in spec/ and run by rspec, hangs and leaks memory rapidly.
The call to windows.class succeeds, but the call to windows.size does not return.
require 'spec_helper'
describe RAutomation::Windows do
it "" do title = SpecHelper::DATA[:window1_title] window1 = RAutomation::Window.new(:title => title) hwnd = window1.windows.first.hwnd windows = window1.windows(:hwnd => hwnd) puts windows.class; $stdout.flush puts windows.size end
end