def METHOD_NAME(a_L_out):
    a, L, out = a_L_out
    before = count_refs(NonlinearVariationalSolver)
    F = action(a, out) - L
    solve(F == 0, out)
    out.dat.data_ro  # force evaluation
    after = count_refs(NonlinearVariationalSolver)
    assert before == after