Skip to content

Commit

Permalink
Merge pull request numpy#2976 from bfroehle/memory_waste
Browse files Browse the repository at this point in the history
BUG: PyArray_LexSort allocates too much temporary memory.
  • Loading branch information
njsmith committed Feb 10, 2013
2 parents 625f3cd + 91376d7 commit 3f6aaa3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/item_selection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,11 +1225,11 @@ PyArray_LexSort(PyObject *sort_keys, int axis)
"need sequence of keys with len > 0 in lexsort");
return NULL;
}
mps = (PyArrayObject **) PyArray_malloc(n*NPY_SIZEOF_PYARRAYOBJECT);
mps = (PyArrayObject **) PyArray_malloc(n * sizeof(PyArrayObject *));
if (mps == NULL) {
return PyErr_NoMemory();
}
its = (PyArrayIterObject **) PyArray_malloc(n*sizeof(PyArrayIterObject));
its = (PyArrayIterObject **) PyArray_malloc(n * sizeof(PyArrayIterObject *));
if (its == NULL) {
PyArray_free(mps);
return PyErr_NoMemory();
Expand Down

0 comments on commit 3f6aaa3

Please sign in to comment.