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

Correct deletion when reassigning a dsarray #430

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dislib/classification/knn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class KNeighborsClassifier(BaseEstimator):
but different labels, the results will depend on the ordering of the
training data.
https://en.wikipedia.org/wiki/K-nearest_neighbor_algorithm

Examples
--------
>>> import dislib as ds
Expand Down
7 changes: 5 additions & 2 deletions dislib/data/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from scipy.sparse import issparse, csr_matrix
from sklearn.utils import check_random_state
import math
import sys


class Array(object):
Expand Down Expand Up @@ -73,8 +74,10 @@ def __init__(self, blocks, top_left_shape, reg_shape, shape, sparse,

def __del__(self):
if self._delete:
[compss_delete_object(b) for r_block in self._blocks for b in
r_block]
for r_block in self._blocks:
for b in r_block:
if sys.getrefcount(b) <= 3:
compss_delete_object(b)

def __str__(self):
return "ds-array(blocks=(...), top_left_shape=%r, reg_shape=%r, " \
Expand Down