Skip to content
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

Growing memory usage on redraw #32

Closed
timholy opened this issue Jul 11, 2014 · 0 comments
Closed

Growing memory usage on redraw #32

timholy opened this issue Jul 11, 2014 · 0 comments

Comments

@timholy
Copy link
Member

timholy commented Jul 11, 2014

As reported on julia-users. I'm debugging this on the Gtk branch to take advantage of precompilation for fast reloading.

Here's a test script:

using Gtk.ShortNames, Base.Graphics, Cairo
using Images, TestImages

img = testimage("mandrill")
buf0 = Images.uint32color(img)

type MyObj
    surface::CairoSurface
end
mycanvas = MyObj(CairoImageSurface(buf0, Cairo.FORMAT_RGB24, flipxy = false))

c = @Canvas(size(buf0,1), size(buf0,2))
win = @Window(c, "Canvas")
draw(c) do widget
    ctx = getgc(c)
    buf = copy(buf0)
    rectangle(ctx, 0, 0, size(buf, 1), size(buf, 2))
    mycanvas.surface = CairoImageSurface(buf, Cairo.FORMAT_RGB24, flipxy = false)
    set_source(ctx, mycanvas.surface)
    fill(ctx)
    reveal(c, false)
end
showall(win)

# for i = 1:20; draw(c); end

If you call the draw loop at the end, memory grows, but gets freed by gc(). That doesn't seem to happen if instead you use ImageView:

imgc, imsl = view(img)
for i = 1:20; view(canvas(imgc), img); end

Not sure why or what's going wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant