Skip to content

Is this a memory leak issue or something else? #181

@aykaramba

Description

@aykaramba

Code:

(defpackage :test (:use :cl :sketch))
(in-package :test)

(defsketch test ((title "test")
                 (size-scale 1)
                 (color-start 0)
                 (height 400)
                 (width 400))
    (let ((cv (make-canvas 400 400)))
         (canvas-paint cv +blue+ 0 0)
         (canvas-paint cv +red+ 0 1)
         (canvas-paint cv +green+ 1 0)
         (canvas-paint cv +black+ 1 1)
      
         (canvas-paint cv +orange+ 2 0)
         (canvas-paint cv +red+ 2 1)
         (canvas-paint cv +blue+ 2 2)

         (canvas-paint cv +green+  1 2)
         (canvas-paint cv +yellow+ 9 9)
         (canvas-paint cv +yellow+ 199 199)
         (canvas-paint cv +yellow+ 399 399)

         (canvas-lock cv)
         (let ((draw-size (* size-scale 400)))
              (draw cv :width draw-size 
                              :height draw-size
                              :min-filter :linear 
                              :mag-filter :linear))))

(make-instance 'test)

I am playing around with sketch and learning canvas. The above code just tries to open a 400x400 window, draw a canvas in it and colour a few pixels just to test.

PROBLEM: I have htop open and the above main (let (())) form starts consuming ram really really quickly.

Is that a memory leak or an issue with the code? It feels like the moment I uncomment the let form and ram starts growing really quickly that the rendering is being done in an additive way instead of overwriting the previous frame like (rectangle 10 10 50 50) would do.

Thoughts or suggestions?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions