From 2a0c9ac38106f2d3043f3cb1db9bba34a8706d77 Mon Sep 17 00:00:00 2001 From: Wes McKinney Date: Fri, 9 Dec 2011 18:43:26 -0500 Subject: [PATCH] BUG: copy index slice causing memory leak described in #467 --- pandas/core/internals.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 730e15ac63d8a..2db0e0854b07e 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -586,7 +586,8 @@ def _add_new_block(self, item, value): # hm, elaborate hack? loc = self.items.get_loc(item) - new_block = make_block(value, self.items[loc:loc+1], self.items) + new_block = make_block(value, self.items[loc:loc+1].copy(), + self.items) self.blocks.append(new_block) def _find_block(self, item):