8000 ENH: Add memory leak test by twmr · Pull Request #10302 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Add memory leak test #10302

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

Closed
wants to merge 1 commit into from
Closed
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: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ addons:
- gfortran
- libatlas-dev
- libatlas-base-dev
- valgrind
# Speedup builds, particularly when USE_CHROOT=1
- eatmydata

Expand Down Expand Up @@ -45,6 +46,7 @@ matrix:
apt:
packages:
- debootstrap
- valgrind
- python: 3.4
env: USE_DEBUG=1
dist: trusty
Expand Down
21 changes: 21 additions & 0 deletions numpy/tests/test_memory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from __future__ import division, absolute_import, print_function

import sys
import subprocess
import itertools


class TestMemory(object):
def test_memory_leak(self):
# see #10157
output = subprocess.check_output([
'valgrind',
sys.executable,
'-c', 'import numpy'], stderr=subprocess.STDOUT)

leak_summary = '\n'.join(
itertools.dropwhile(lambda x: not x.endswith('LEAK SUMMARY:'),
output.decode().splitlines()))

if 'definitely lost: 0 bytes in' not in leak_summary:
raise ValueError(leak_summary)
0