From 876750681a10491c5f0bb1640c64070a8518589b Mon Sep 17 00:00:00 2001 From: Guillaume Hivert Date: Fri, 17 May 2024 15:56:36 +0200 Subject: [PATCH] Update README with memory leak warning Signed-off-by: Guillaume Hivert --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index d776483..f289b80 100644 --- a/README.md +++ b/README.md @@ -56,3 +56,15 @@ pub fn main() { ```sh gleam add gleam_pgo ``` + +## Limitations + +Currently, this package should be used to instanciate a bunch of connections, +and reuse them everywhere. __Do not__ open and close connections dynamically, +for instance at launch and shutdown of a process. This will expose your +application to a memory leak, and will lead to undesired runtime crashes. + +> Why is that happening? To maintain the PG connection, PGO needs to keep an Erlang atom. +> Erlang atom are specials, because they're allowed once when using them, and +> they're never garbaged. When generating dynamically lots of atoms, you expose +> your application to a memory leak.