From 44fb592008c2ecfbfc89725a8ae1638711dfa423 Mon Sep 17 00:00:00 2001 From: Mark Dain Date: Mon, 13 Jan 2014 00:12:44 +0000 Subject: Added note about memory leak (Fixes #15) This is something fairly important, it shouldn't be left out of the documentation. --- doc.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc.go') diff --git a/doc.go b/doc.go index c8eb758..feeddd0 100644 --- a/doc.go +++ b/doc.go @@ -48,6 +48,12 @@ And finally we call session.Save() to save the session in the response. Note that in production code, we should check for errors when calling session.Save(r, w), and either display an error message or otherwise handle it. +Important Note: If you aren't using gorilla.Mux, you need to use +context.ClearHandler as your handler on ListenAndServe else you will leak memory! +The ClearHandler function is provided by the gorilla/context package. + + http.ListenAndServe(":8080", context.ClearHandler(http.DefaultServeMux)) + That's all you need to know for the basic usage. Let's take a look at other options, starting with flash messages. -- cgit v1.2.3