Langsung ke konten
Skillpedia
Website & UI (frontend)75k · #2933

memory-leaks

Fungsinya

Skill ini meninjau kode sisi browser untuk pola yang membuat memori tetap digunakan setelah tidak lagi diperlukan. Skill ini cocok untuk developer front-end yang aplikasi single-page-nya melambat saat sesi panjang.

Kapan dipakai

  • ✓Saat Anda meminta agent memeriksa aplikasi web untuk kebocoran memori.
  • ✓Saat halaman semakin lambat semakin lama pengguna membukanya atau berpindah antar layar.
  • ✓Saat Anda meninjau komponen dan ingin memastikan listener, timer, dan permintaannya dibersihkan.

Link skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/memory-leaks/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/memory-leaks/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit →

Contoh permintaan ke AI

“Aplikasi web saya semakin lambat jika dipakai lama. Bisakah Anda memeriksa kodenya untuk kebocoran memori?”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent mencari event listener yang tidak pernah dilepas, timer yang terus berjalan, referensi ke elemen halaman yang sudah dihapus, dan permintaan yang tetap berjalan setelah tampilan ditutup. Agent lalu menyarankan langkah pembersihan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Prevent common memory leak patterns

Memory leaks cause applications to consume increasing amounts of memory over time, eventually slowing the browser tab or crashing it. In single-page applications, where users don't reload the page, small leaks in components accumulate with each navigation and can make an app unusable after 30 minutes of use.

Quick Reference

  • Remove event listeners when the element or component is destroyed
  • Clear setInterval and setTimeout when they're no longer needed
  • Avoid storing DOM references in long-lived objects after elements are removed
  • Use WeakMap and WeakSet when storing metadata about objects you don't own
  • Use AbortController to cancel stale async requests when UI state changes

Check

Analyze this code for memory leak patterns: uncleaned event listeners, retained DOM references after removal, closures holding large objects, and uncleared timers. Also flag fetches and async tasks that continue after the owning component or view is gone.

Fix

Fix the memory leaks in this code by cleaning up event listeners, clearing timers, canceling stale async requests, and releasing DOM references when they're no longer needed.

Explain

Explain the four most common JavaScript memory leak patterns and how to detect them with Chrome DevTools.

Code Review

Review scripts, client components, and browser execution paths related to Prevent common memory leak patterns. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/memory-leaks

Pertanyaan umum

Bagaimana saya bisa memastikan kebocoran sendiri?

Skill menyarankan memakai Chrome DevTools untuk memantau penggunaan memori dan mendeteksi pola kebocoran.

Untuk apa AbortController digunakan?

Alat ini membatalkan permintaan yang sudah tidak relevan saat pengguna sudah berpindah, sehingga hasilnya tidak memperbarui layar lama.

Pola kebocoran apa yang paling umum?

Skill membahas listener yang tidak dibersihkan, referensi DOM yang tertahan, closure yang menyimpan objek besar, dan timer yang tidak dihentikan.

Detail

Deskripsi asli dari pembuat

Use when reviewing scripts, client components, bundles, or runtime behavior related to Prevent common memory leak patterns. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.

repo: thedaviddias/Front-End-Checklist

Popularitas

Bintang GitHub
75k
Peringkat
#2933
Lisensi
MIT
Diperbarui
31/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa