Email or username:

Password:

Forgot your password?
Top-level
Eugen Rochko

@haitch The program works! It does what it's supposed to do. It just leaks memory while doing it.

I think the sync.Pool approach might not be working well. What I need is to allocate a fixed number of ImageOps objects and then use them from the handler in a thread-safe way. I don't know how to do that in Go, however.

What also gives me pause is how the bytes of the image are passed around. I feel like there might be more efficient methods of doing it

No comments
@h

@Gargron You're using sync.Pool, and that is expected behaviour. It doesn't free memory immediately.

https://golang.org/pkg/sync/#Pool

If you would like something more efficient and less hermetic, you should probably implement this using goroutines, and return your image blobs via channels.
That will give you ultimate control and won't be lax with the abuse of memory.

Go Up