Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

large memory leak in new contour routine #6940

Closed
Assignees
ianthomas23
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug
Milestone
@efiring

Description

@efiring

In master and in 1.5.1, the new C++ contour routine has a massive memory leak; the 'legacy' mode does not. The following script illustrates this; run it as-is and then with the 'legacy' kwarg uncommented for comparison. (The script is long only because it seemsreport_memory has been removed fromcbook. Unless it has simply been moved elsewhere or renamed, we need to bring it back.)

importnumpyasnpimportmatplotlibmatplotlib.use('agg')importmatplotlib.pyplotasplt# from matplotlib.cbook import report_memoryimportos,sysdefreport_memory(i=0):# argument may go away'return the memory consumed by process'frommatplotlib.compat.subprocessimportPopen,PIPEpid=os.getpid()ifsys.platform=='sunos5':try:a2=Popen('ps -p %d -o osz'%pid,shell=True,stdout=PIPE).stdout.readlines()exceptOSError:raiseNotImplementedError("report_memory works on Sun OS only if ""the 'ps' program is found")mem=int(a2[-1].strip())elifsys.platform.startswith('linux'):try:a2=Popen('ps -p %d -o rss,sz'%pid,shell=True,stdout=PIPE).stdout.readlines()exceptOSError:raiseNotImplementedError("report_memory works on Linux only if ""the 'ps' program is found")mem=int(a2[1].split()[1])elifsys.platform.startswith('darwin'):try:a2=Popen('ps -p %d -o rss,vsz'%pid,shell=True,stdout=PIPE).stdout.readlines()exceptOSError:raiseNotImplementedError("report_memory works on Mac OS only if ""the 'ps' program is found")mem=int(a2[1].split()[0])elifsys.platform.startswith('win'):try:a2=Popen(["tasklist","/nh","/fi","pid eq %d"%pid],stdout=PIPE).stdout.read()exceptOSError:raiseNotImplementedError("report_memory works on Windows only if ""the 'tasklist' program is found")mem=int(a2.strip().split()[-2].replace(',',''))else:raiseNotImplementedError("We don't have a memory monitor for %s"%sys.platform)returnmemnp.random.seed(0)z=np.random.randn(500,100)foriinrange(200):fig,ax=plt.subplots()ax.contourf(z)# , corner_mask='legacy')fig.savefig('temp.png')plt.close(fig)ifi%10==0:print(i,report_memory(i))

Metadata

Metadata

Assignees

Labels

Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.status: confirmed bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp