Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak with optimize skopt #883

Open
diegolovison opened this issue Jan 20, 2023 · 1 comment · May be fixed by #884
Open

Memory leak with optimize skopt #883

diegolovison opened this issue Jan 20, 2023 · 1 comment · May be fixed by #884

Comments

@diegolovison
Copy link

Expected Behavior

No memory leak

Actual Behavior

A huge amount of memory that prevents the optimization process

Steps to Reproduce

Create the folling class

  class MyMemoryDumper(object):
      def __init__(self):
          self.every = 2000
          self.count = 0

      def __call__(self, res):
          if self.count != 0 and self.count % self.every == 0:
              obj_list = gc.get_objects()
              new_values = {}
              for obj in obj_list:
                  size_obj = sys.getsizeof(obj)
                  new_values[str(obj)] = size_obj
              new_values = sorted(new_values)
              print('end')
          self.count += 1

Add it to base_estimator

forest_minimize( 
      base_estimator=ExtraTreesRegressor(n_estimators=20, min_samples_leaf=2),
      callback=[DeltaXStopper(9e-7), MyMemoryDumper()],

Additional info

Add a breakpoint in MyMemoryDumper::print('end'). There are a lot of DataFrames from self.run

Backtesting==0.3.3
OS: Windows

@diegolovison
Copy link
Author

Maybe this can help ?

@kernc kernc linked a pull request Jan 21, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant