Skip to content

Commit

Permalink
Update README with memory leak warning
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Hivert <[email protected]>
  • Loading branch information
ghivert authored and lpil committed May 17, 2024
1 parent a39a5b8 commit 8767506
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 8767506

Please sign in to comment.