Skip to content

About

Tests for potential memory leaks in the `postgres` npm package when used in Cloudflare Workers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

npm postgres Package Memory Leak Test Sample

Tests for potential memory leaks in the postgres npm package when used in Cloudflare Workers.

Usage

  1. Start PostgreSQL: docker-compose up -d
  2. Install deps: npm install
  3. Run worker: npm run dev
  4. Test endpoint: curl http://localhost:8787/leak-test

The /leak-test endpoint creates a postgres connection, executes SELECT 1, and closes with sql.end(). Repeated requests help identify memory leaks.

Memory Monitoring

Monitor memory usage with Cloudflare Workers dev tools: https://developers.cloudflare.com/workers/observability/dev-tools/memory-usage/

Memory Leak Evidence

Chrome DevTools memory profiler showing increased object retention after repeated requests:

Memory Leak Profile

About

Tests for potential memory leaks in the `postgres` npm package when used in Cloudflare Workers.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages