design_patterns-pool_repool

Enforce borrow-return lifecycle for pooled objects with GetWithRepool and repool closures.

2|Updated Jun 26, 2025
One-click install
npx skills add https://github.com/amarbel-llc/dodder --skill design-patterns-pool-repool
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: design_patterns-pool_repool
Source: https://github.com/amarbel-llc/dodder/tree/main/.claude/skills/design_patterns-pool_repool
Command: npx skills add https://github.com/amarbel-llc/dodder --skill design-patterns-pool-repool

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Dodder's pooling pattern enforces a mandatory borrow-return lifecycle, ensuring that every pooled element is paired with a repool closure that must be invoked exactly once to release the resource, preventing leaks and inconsistent states.

Core Features & Use Cases

  • Deterministic lifecycle: each pool GetWithRepool returns an element and a repool function to be called when finished.
  • Enforcement layers: static analysis, runtime debug poisoning, and lint checks guard proper repool usage.
  • Flexibility: supports cloning pooled objects via CloneTransacted and safe reuse across concurrent tasks.

Quick Start

Obtain an element with GetWithRepool and ensure repool is invoked (e.g., via defer) to release the resource.

Frequently Asked Questions about design_patterns-pool_repool

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent memory leaks when using object pooling in Go?

To prevent memory leaks in Go object pooling, enforce a mandatory borrow-return lifecycle where every GetWithRepool call is paired with a repool closure invoked exactly once, typically via defer, to release the resource.

What is the GetWithRepool pattern for managing resource lifecycles?

The GetWithRepool pattern is a deterministic resource lifecycle mechanism that returns a pooled element and a repool function, ensuring the borrowed object is safely returned to the pool when finished.

Does static analysis detect improper pooled object reuse in concurrent tasks?

Static analysis detects improper pooled object reuse by enforcing correct repool usage across concurrent tasks, guarding against inconsistent states and leaked resources through lint checks and runtime debug poisoning.

How do I clone pooled objects safely without causing inconsistent states?

You can clone pooled objects safely by using CloneTransacted, which supports flexible reuse across concurrent tasks while maintaining the mandatory borrow-return lifecycle enforced by the repool closure.

When do I need the //repool:owned annotation in my code?

You need the //repool:owned annotation when appropriate to explicitly control object lifetimes and suppress analyzer warnings related to the mandatory borrow-return lifecycle in Go-like environments.

What is the best way to enforce safe resource pooling across concurrent tasks?

The best way to enforce safe resource pooling across concurrent tasks is by combining static analysis, runtime debug poisoning, and lint checks to mandate the GetWithRepool pattern and ensure every repool closure is invoked exactly once.