File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
sklearn/ensemble/_hist_gradient_boosting Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -603,6 +603,9 @@ def split_next(self):
603
603
smallest_child .allowed_features ,
604
604
)
605
605
)
606
+ # node.histograms is reused in largest_child.histograms. To break cyclic
607
+ # memory references and help garbage collection, we set it to None.
608
+ node .histograms = None
606
609
self .total_compute_hist_time += time () - tic
607
610
608
611
tic = time ()
@@ -618,8 +621,9 @@ def split_next(self):
618
621
if child .is_leaf :
619
622
del child .histograms
620
623
621
- # We do not release the memory of node.histograms as it is reused in one of the
622
- # child nodes.
624
+ # Release memory used by histograms as they are no longer needed for
625
+ # internal nodes once children histograms have been computed.
626
+ del node .histograms
623
627
624
628
return left_child_node , right_child_node
625
629
You can’t perform that action at this time.
0 commit comments