I have a small server which has to handle a lot of files. The files are send via a PUT request to the server. I am using the net/http package for the server. I know that for every request a go routine is opened. But the problem is that after a request is finished the used memory of the handler is not released.
The server (should) run on a Raspery Pi 3 with 1GB memory. The problem is that it runs out of memory, when I am sending a lot of files. At this point I can not wait until the garbage collector releases the memory.
This two topics are about the problem:
Why is the memory block not cleaned by the garbage collector?
Go 1.3 Garbage collector not releasing server memory back to system
But there is no solution for my problem.
Now the question is: is there a way to make a http handler marked as totaly ready, that the garbage collector releases the memory for the calling routine? I tried to add a return
at the end of the handler, but that doesn't work. I am runing still out of memory.