Memory leak in github.com/golang/freetype

78 views
Skip to first unread message

Manlio Perillo

unread,
May 13, 2020, 5:03:30 PM5/13/20
to golang-nuts
The following program using the freetype package leaks memory:

The first two cycles have no problems but starting with the third cycle there is in an abnormal increase of CPU and memory usage.
At the fourth cycle on my system the program is terminated by the OOM killer.

I looked at the NewFace implementation (https://github.com/golang/freetype/blob/master/truetype/face.go#L179) but I don't understand why memory is leaked.



Thanks
Manlio

Robert Engels

unread,
May 13, 2020, 5:50:15 PM5/13/20
to Manlio Perillo, golang-nuts
That is a very large dpi and size. The cache that is created is going to be very large. I am guessing that it allocates so much memory so fast that the process is killed by the OS Out of memory killer before the GC runs to free the “dead” faces. Thus the OOM death..

On May 13, 2020, at 4:03 PM, Manlio Perillo <manlio....@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/680c0031-65a0-4695-a1eb-5bcd18b39b2e%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages