My testing jester app memory keep rising. when start res mem around 2MB then go up to 12MB with about 50 load. I want to ask for how to use db_sqlite correctly? right now I'm just open in the beginning but no close (not know where to close) do I need to do db.close in every route?
import jester
let db = open("chinook.db","","","")
s.add "footer" resp s
Nim does not free memory back to the OS. So it's memory will always rise, its internal free pool will be free but the OS will not see it that way. If you allocated 12GB of stuff then free it. OS will report it using 12GB... while your nim program knows it has 12GB in its "free buffer".
Is this true with manual memory management as well, or just the built-in memory management and GC?
Like, if you were to, say, manually allocate space to load and copy/resize a 20 megapixel photo, will the app continue to occupy 200 MB of RAM even after the memory is released by the app?
In c it depends which allocator you use. Most people don't use the default malloc because it's slow. They have a layer above it which uses it for big chunks while using internal thing for small chunks.
For really big chunks Nim will use the standard is malloc and they will free back. This does not happen in web servers.