Skip to content

PermGen memory leak in Browser.drive(Closure script) #335

@geb-bot

Description

@geb-bot

Originally created by Terence Kent.

Overview:
Each call to Browser.driver(Closure script) leaks a small amount of PermGen memory. The leak appears to be caused by creating a new geb.Configuration object every time.

Steps to reproduce:

  1. Create a standard GebConfig.groovy file in the expected place
  2. Run the following code: while(true){ Browser.drive {} }
  3. Attached a debugger and watch the PermGen usage

(I've also attached a tiny program to demonstrate the issue)

Workaround:
The work around is to not use Browser.drive(Closure script) and instead use one of the other other Browser.drive methods that result in a cached Configuration object being used.

Impact:
This bug will prevent long-running applications from relying on Geb for regular tasks, without discovering/working around this issue. This is more difficult than it sounds since the Book of Geb almost exclusively uses examples with Browser.drive(Closure script) and you won't discover the issue after the program has been running for some time.

Possible Solutions:

  1. Cache the configuration, the same way the webdriver is cached. If a concern shows up about supporting changing configs, make the old behavior possible through a system property.
  2. Adjust how the configuration works so the configuration classes created by GebConfig.groovy (or other config file) can be garbage collected. I have to assume this is possible, though I'm still new to groovy.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions