How to release memory when reading images from buffers #406
Replies: 2 comments
-
Garbage collection is difficult in golang. govips can be pretty efficient and gobble more memory than the gc can release. https://tip.golang.org/doc/gc-guide You can adjust some gc parameters to make it more aggressive: You could also try putting the image processing parts into goroutines or even separate processes. |
Beta Was this translation helpful? Give feedback.
-
Sounds like your service is quite like us https://github.com/webp-sh/webp_server_go and https://webp.se 😃 Maybe you could try using
|
Beta Was this translation helpful? Give feedback.
-
I am trying to build an API that can accept many http calls per second. For each of these, my service will stream down into memory an image taken from a URL, do some modifications on top of it and then serve it back (or currently just saving the image file).
I am trying to load test this service and I am noticing that the memory doesn't get released from GoVips and I am wondering if I am doing something wrong.
am I doing something visibly wrong or should I correctly expect the memory to be released properly by itself once the image is saved? The problem here is that most likely there is a go routine being spawned from every http call reaching the API.. I just don't know what happens next when it comes to GoVips
Beta Was this translation helpful? Give feedback.
All reactions