-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Memory leak in LogisticRegression #8499
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
Comments
Adding |
Thank you, indeed it does. However, it seems to matter where the |
P. S.: I tested performance (expressed as number of estimations per second) with this modified code: import sklearn
from sklearn.linear_model import LogisticRegression
import numpy as np
import time
import psutil
import os
import gc
if __name__ == "__main__":
print("Sklearn version: %s" % sklearn.__version__)
n_samples = 2
n_features = 2
data = np.arange(n_samples*n_features).reshape((n_samples,n_features))
labels = np.arange(n_samples)
last_output_time = 0
process = psutil.Process(os.getpid())
for i in range(10000000):
clf = LogisticRegression()
clf.fit(X=data, y=labels)
#clf.predict(X=data)
#clf.predict_proba(X=data)
del clf
#gc.collect()
if time.time()-last_output_time >= 5:
gc.collect()
print("%d iterations, %f MB" % (i, process.get_memory_info()[0] / float(2 ** 20)))
last_output_time = time.time() |
Ok I didn't realize you were doing so many iterations. Interestingly, the memory leak seems present only with |
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
The leak resulted from two issues: - not freeing the problem struct - not freeing the number of iterations The former was present in the initial version of ``liblinear_helper.c`` while latter appeared after c8c72fd which introduced ``n_iter``. Closes scikit-learn#8499
Dear all,
while running many logistic regressions, I encountered a continuous memory increase on several (Debian) machines. The problem is isolated in this code:
This was Python 2.7 under Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1+deb8u1 (2017-02-22) x86_64 GNU/Linux, with scikit-learn 0.18.1. Is this reproducable?
The text was updated successfully, but these errors were encountered: