jarmo / RAutomation

RAutomation
MIT License
100 stars 33 forks source link

Windows#size can hang and leak memory #2

Closed BurdetteLamar closed 12 years ago

BurdetteLamar commented 13 years ago

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

jarmo commented 13 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.

jarmo commented 13 years ago

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 :)

BurdetteLamar commented 13 years ago

I should have said that memory use increases without bound, not that there's a memory leak. Thanks.

jarmo commented 12 years ago

not allowing :pid and :hwnd for searching collections: https://github.com/jarmo/RAutomation/commit/4eea1c09d31efcecde9e8f803d71467eaf3feaf6

BurdetteLamar commented 12 years ago

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