Skip to content

Memory Leak Creating New Pics #48

@redstarcoder

Description

@redstarcoder

If you create many images, despite using Pic.Free, Turing will ultimately consume all the memory it's allowed to and crash. Code:

View.Set ("graphics:1024;600,offscreenonly")

var spinbox, newbox, angle : int
angle := 0

Draw.FillBox (50, 50, 150, 150, brightcyan)
spinbox := Pic.New (0, 0, 200, 200)
newbox := Pic.Rotate (spinbox, angle, 100, 100)

loop
    cls

    angle := angle + 4
    if angle >= 360 then
        angle := 0
    end if
    Pic.Free (newbox)
    newbox := Pic.Rotate (spinbox, angle, 100, 100)
    
    Pic.Draw (newbox, 600, 300, picCopy)
    
    View.Update ()
    delay (10)
end loop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions