Exemplo n.º 1
0
def plot():
    fig = Figure()
    i = 0
    while True:
        print i,report_memory(i)
        fig.clf()
        ax = fig.add_axes([0.1,0.1,0.7,0.7])
        ax.plot([1,2,3])
        i += 1
Exemplo n.º 2
0
def plot():
    fig = Figure()
    i = 0
    while True:
        print(i, report_memory(i))
        fig.clf()
        ax = fig.add_axes([0.1, 0.1, 0.7, 0.7])
        ax.plot([1, 2, 3])
        i += 1
Exemplo n.º 3
0
    t1 = np.arange(0.0, 2.0, 0.01)
    y1 = np.sin(2*np.pi*t1)
    y2 = rand(len(t1))
    X = rand(50,50)

    ax = fig.add_subplot(221)
    ax.plot(t1, y1, '-')
    ax.plot(t1, y2, 's')


    ax = fig.add_subplot(222)
    ax.imshow(X)

    ax = fig.add_subplot(223)
    ax.scatter(rand(50), rand(50), s=100*rand(50), c=rand(50))

    ax = fig.add_subplot(224)
    ax.pcolor(10*rand(50,50))

    fig.savefig('tmp%d' % i, dpi = 75)
    close(1)

    gc.collect()
    val = report_memory(i)
    print i, val
    if i==indStart: start = val # wait a few cycles for memory usage to stabilize

end = val
print 'Average memory consumed per loop: %1.4fk bytes\n' % ((end-start)/float(indEnd-indStart))

Exemplo n.º 4
0
matplotlib.rcParams['toolbar'] = matplotlib.validate_toolbar(options.toolbar)
if options.backend:
    matplotlib.use(options.backend)
import pylab
import matplotlib.cbook as cbook

print('# columns are: iteration, OS memory (k), number of python objects')
print('#')
for i in range(indEnd+1):

    fig = pylab.figure()
    fig.savefig('test')  # This seems to just slow down the testing.
    fig.clf()
    pylab.close(fig)
    gc.collect()
    val = cbook.report_memory(i)
    if options.verbose:
        if i % 10 == 0:
            #print ("iter: %4d OS memory: %8d Python objects: %8d" %
            print ("%4d %8d %8d" %
                   (i, val, len(gc.get_objects())))
    if i==indStart: start = val # wait a few cycles for memory usage to stabilize

gc.collect()
end = val

print('# columns above are: iteration, OS memory (k), number of python objects')
print('#')
print('# uncollectable list:', gc.garbage)
print('#')
Exemplo n.º 5
0
    t1 = np.arange(0.0, 2.0, 0.01)
    y1 = np.sin(2 * np.pi * t1)
    y2 = rand(len(t1))
    X = rand(50, 50)

    ax = fig.add_subplot(221)
    ax.plot(t1, y1, '-')
    ax.plot(t1, y2, 's')

    ax = fig.add_subplot(222)
    ax.imshow(X)

    ax = fig.add_subplot(223)
    ax.scatter(rand(50), rand(50), s=100 * rand(50), c=rand(50))

    ax = fig.add_subplot(224)
    ax.pcolor(10 * rand(50, 50))

    fig.savefig('tmp%d' % i, dpi=75)
    close(1)

    gc.collect()
    val = report_memory(i)
    print i, val
    if i == indStart:
        start = val  # wait a few cycles for memory usage to stabilize

end = val
print 'Average memory consumed per loop: %1.4fk bytes\n' % (
    (end - start) / float(indEnd - indStart))
Exemplo n.º 6
0
matplotlib.rcParams['toolbar'] = matplotlib.validate_toolbar(options.toolbar)
if options.backend:
    matplotlib.use(options.backend)
import pylab
import matplotlib.cbook as cbook

print('# columns are: iteration, OS memory (k), number of python objects')
print('#')
for i in range(indEnd+1):

    fig = pylab.figure()
    fig.savefig('test')  # This seems to just slow down the testing.
    fig.clf()
    pylab.close(fig)
    gc.collect()
    val = cbook.report_memory(i)
    if options.verbose:
        if i % 10 == 0:
            #print ("iter: %4d OS memory: %8d Python objects: %8d" %
            print ("%4d %8d %8d" %
                   (i, val, len(gc.get_objects())))
    if i==indStart: start = val # wait a few cycles for memory usage to stabilize

gc.collect()
end = val

print('# columns above are: iteration, OS memory (k), number of python objects')
print('#')
print('# uncollectable list:', gc.garbage)
print('#')
Exemplo n.º 7
0
from __future__ import print_function
from matplotlib.pylab import *
import matplotlib.cbook as cbook

data = ones((1500, 1500, 3))
imshow(data)
ax = gca()
print(cbook.report_memory())
print(len(ax.images))
hold(False)
imshow(data)
print(cbook.report_memory())
print(len(ax.images))
imshow(data)
print(cbook.report_memory())
print(len(ax.images))
imshow(data)
print(cbook.report_memory())
print(len(ax.images))
imshow(data)
print(cbook.report_memory())
print(len(ax.images))