zenstack icon indicating copy to clipboard operation
zenstack copied to clipboard

Memory leak: Enhanced client creates 156K+ Zod schemas that are never garbage collected

Open kamiletar opened this issue 10 months ago • 0 comments

⚠️ CLOSED - Need more investigation

This issue was created prematurely. We're still investigating the root cause of the memory leak.


Original Description

Using getEnhancedPrisma() / enhance() causes severe memory leak. The enhanced client creates new Zod schema objects on every database query that are never garbage collected.

Environment

  • ZenStack: 3.2.x
  • Node.js: 24
  • Next.js: 16
  • Zod: 4.x
  • Database: PostgreSQL

Status

Closing this issue as we need to confirm the actual cause. Will reopen with proper reproduction steps once we identify the real problem.

kamiletar avatar Jan 29 '26 22:01 kamiletar