[Numpy-svn] [numpy/numpy] c7b5fa: MAINT: Allocate fewer bytes for empty arrays.

GitHub noreply at github.com
Mon Jul 11 17:07:52 EDT 2016


  Branch: refs/heads/maintenance/1.11.x
  Home:   https://github.com/numpy/numpy
  Commit: c7b5fad058befba3ba07f325a3c8fc6bc2c07b2e
      https://github.com/numpy/numpy/commit/c7b5fad058befba3ba07f325a3c8fc6bc2c07b2e
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2016-07-11 (Mon, 11 Jul 2016)

  Changed paths:
    M numpy/core/src/multiarray/ctors.c

  Log Message:
  -----------
  MAINT: Allocate fewer bytes for empty arrays.

Currently the number of bytes allocated is the product of the non-zero
dimensions x element_size, which can create huge memory allocations for
empty arrays. Change that to just allocate enough for one element. Some
allocation is needed for the array.data attribute to work correctly.

Note: Could probably allocate a minimal number of bytes, say 16 as
dictated by alignment, but the old intended number is used here as a
more conservative fix.

Closes #7813.


  Commit: 309e1421acc08f21937506ecf214fb12d3864045
      https://github.com/numpy/numpy/commit/309e1421acc08f21937506ecf214fb12d3864045
  Author: Charles Harris <charlesr.harris at gmail.com>
  Date:   2016-07-11 (Mon, 11 Jul 2016)

  Changed paths:
    M numpy/core/src/multiarray/ctors.c

  Log Message:
  -----------
  Merge pull request #7824 from charris/backport-7820

Backport 7820, MAINT: Allocate fewer bytes for empty arrays.


Compare: https://github.com/numpy/numpy/compare/d7f6cc6c5276...309e1421acc0


More information about the Numpy-svn mailing list