Anyone who is good at #Golang can you tell me what memory management crimes I am committing here?
Anyone who is good at #Golang can you tell me what memory management crimes I am committing here? No comments
@Gargron I would start by debugging all the lilliput library bits. (which is C based and probably not a straight Go problem) @Gargron can't do the greatest review from my phone but nothing major sticks out to me. What Gamo is useful/used for: Proxying the server thumbnails on joinmastodon.org in a way that optimizes them and resizes them to the dimensions they're actually displayed at, reducing the total page size from 16 MB to 4 MB (there's still work to be done to lower that number) @Gargron Not seeing anything directly obviously wrong with it honestly. Ideally this line https://github.com/tootsuite/gamo/blob/master/gamo.go#L159 would receive an io.Reader rather than the complete image as a []byte but this seems like a limitiation of lilliput (and down there probably an opencv limitiation). Perhaps add some tests and run some profilers if you want to be really sure @Gargron are you getting tons of requests at once? From what I see your server doesn't have any limits on concurrent http handlers and you load load a lot of data, instantiate the decoder and so on. All that before you even get to the processing part. I recommend you use a semaphore at the beginning of your handler or a http framework that can limit concurrent connections. Let's say the pool can process 5 req/s but you get 15 http reqs/s. Then your memory fills up. |
@Gargron tootcrimes