Overview When a Joget BeanShell script runs once, a small resource leak may not look serious. When the same script runs inside workflow tools, schedulers, post-processing scripts, or high-traffic forms, unclosed resources can slowly exhaust database connections, mail sessions, streams, memory, or thread context. This article focuses on practical leak prevention for Joget developers writing BeanShell scripts. How It Works Most issues are not classic Java heap leaks. They are usually resource leaks: Database connections not closed. ResultSet or PreparedStatement objects left open. Mail folders, stores, files, streams, or HTTP responses not closed. Workflow thread user changed and not restored. Large result sets loaded into memory without paging. Service/plugin lookups repeated inside loops. The fix is to keep resource scope small and always clean up in inally.…