{"json_modified": "2016-07-31T08:32:43.856943", "uuid": "5993c50c-c39f-4375-a9ea-fd0daaa305f7", "title": "Avoiding leaks in JavaScript XPCOM components", "url": "/en-US/docs/Mozilla/Tech/XPCOM/Guide/Avoiding_leaks_in_JavaScript_components", "tags": ["Obsolete", "add-ons", "XPCOM", "Extensions", "Developing Mozilla", "Add-ons", "NeedsUpdate", "XPCOM:Language Bindings", "XPConnect"], "translations": [], "modified": "2016-07-31T08:32:44", "label": "Avoiding leaks in JavaScript XPCOM components", "localization_tags": [], "locale": "en-US", "id": 14397, "last_edit": "2016-07-31T08:32:38", "summary": "Programmers writing and reviewing JavaScript code in Mozilla should understand how code using XPCOM in JavaScript can leak so that they can avoid leaks. This document attempts to help them do so, first by explaining the underlying concepts, and second by describing a number of common JavaScript patterns that cause leaks.", "sections": [{"id": "Basics_of_memory_management", "title": "Basics of memory management"}, {"id": "malloc_and_free_.28or_new_and_delete.29", "title": null}, {"id": "Reference_counting", "title": "Reference counting"}, {"id": "Garbage_collection", "title": "Garbage collection"}, {"id": "Memory_management_in_XPCOM_and_JavaScript", "title": "Memory management in XPCOM and JavaScript"}, {"id": "Things_not_to_do", "title": "Things not to do"}, {"id": "Don.27t_store_temporary_objects_permanently_in_global_variables", "title": "Don't store temporary objects permanently in global variables"}, {"id": "Don.27t_create_cycles_through_XPCOM", "title": "Don't create cycles through XPCOM"}, {"id": "Don.27t_store_short-lived_objects_as_JavaScript_properties_of_short-lived_DOM_nodes", "title": "Don't store short-lived objects as JavaScript properties of short-lived DOM nodes"}, {"id": "Further_reading", "title": "Further reading"}], "slug": "Mozilla/Tech/XPCOM/Guide/Avoiding_leaks_in_JavaScript_components", "review_tags": []}