From 5371f8a2dc3fbef3319fc60f933ffcadb1dd88c8 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Wed, 26 Apr 2017 14:28:25 +0200
Subject: [PATCH] add a note about memory leaks to Drawer and Sprite docs

---
 drawer.go | 5 +++++
 sprite.go | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/drawer.go b/drawer.go
index 4ee50c8..25d61aa 100644
--- a/drawer.go
+++ b/drawer.go
@@ -15,6 +15,11 @@ package pixel
 //
 // Whenever you change the Triangles, call Dirty to notify Drawer that Triangles changed. You don't
 // need to notify Drawer about a change of the Picture.
+//
+// Note, that Drawer caches the results of MakePicture from Targets it's drawn to for each Picture
+// it's set to. What it means is that using a Drawer with an unbounded number of Pictures leads to a
+// memory leak, since Drawer caches them and never forgets. In such a situation, create a new Drawer
+// for each Picture.
 type Drawer struct {
 	Triangles Triangles
 	Picture   Picture
diff --git a/sprite.go b/sprite.go
index 9b08e51..6ac9aeb 100644
--- a/sprite.go
+++ b/sprite.go
@@ -11,6 +11,11 @@ import "image/color"
 //
 // To achieve different anchoring, transformations and color masking, use SetMatrix and SetColorMask
 // methods.
+//
+// Note, that Sprite caches the results of MakePicture from Targets it's drawn to for each Picture
+// it's set to. What it means is that using a Sprite with an unbounded number of Pictures leads to a
+// memory leak, since Sprite caches them and never forgets. In such a situation, create a new Sprite
+// for each Picture.
 type Sprite struct {
 	tri   *TrianglesData
 	frame Rect
-- 
GitLab