{"json_modified": "2015-07-19T23:28:50.796993", "slug": "Web/JavaScript/Memory_Management", "tags": ["coletor", "mem\u00f3ria"], "locale": "pt-BR", "title": "Gerenciamento de Mem\u00f3ria", "translations": [{"title": "Memory Management", "url": "/en-US/docs/Web/JavaScript/Memory_Management", "tags": ["memory", "JavaScript"], "summary": "Low-level languages, like C, have low-level memory management primitives like malloc()
and free()
. On the other hand, JavaScript values are allocated when things (objects, strings, etc.) are created and \"automatically\" free'd when they are not used anymore. The latter process is called garbage collection. This \"automatically\" is a source of confusion and gives JavaScript (and high-level languages) developers the impression they can decide not to care about memory management. This is a mistake.", "localization_tags": [], "locale": "en-US", "last_edit": "2015-04-11T14:30:15", "review_tags": []}, {"title": "\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\uc758 \uba54\ubaa8\ub9ac\uad00\ub9ac", "url": "/ko/docs/Web/JavaScript/Memory_Management", "tags": [], "summary": "C \uc5b8\uc5b4\uac19\uc740 \uc800\uae09 \uc5b8\uc5b4\ub294 \uba54\ubaa8\ub9ac \uad00\ub9ac\ub97c \uc704\ud574\u00a0malloc()
\u00a0\uacfc\u00a0free()
\ub97c \uc0ac\uc6a9\ud55c\ub2e4. \ubc18\uba74, \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\ub294 \ubb34\uc5b8\uac00\uac00 \uc0dd\uc131\ub418\uc5c8\uc744 \ub54c(\uc624\ube0c\uc81d\ud2b8\ub098 \ubb38\uc790\uc5f4 \ub4f1) \uba54\ubaa8\ub9ac\ub97c \ud560\ub2f9\ud558\uace0 \uc4f8\ubaa8 \uc5c6\uc5b4\uc84c\uc744 \ub54c '\uc790\ub3d9\uc73c\ub85c' free \ud55c\ub2e4. '\uc790\ub3d9\uc73c\ub85c' \ub77c\ub294 \ub9d0\uc5d0\ub294 \ud63c\ub780\uc758 \uc5ec\uc9c0\uac00 \uc788\ub2e4. \uc774\ub294 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\ub97c \ud3ec\ud568\ud55c \uc5ec\ub7ec \uace0\uae09 \uc5b8\uc5b4 \uac1c\ubc1c\uc790\ub4e4\uc5d0\uac8c \uba54\ubaa8\ub9ac \uad00\ub9ac\uac00 \ubd88\uac00\ub2a5\ud558\ub2e4\ub294 \uc778\uc0c1\uc744 \uc900\ub2e4. \ud558\uc9c0\ub9cc \uc2e4\uc0c1\uc740 \uadf8\ub807\uc9c0 \uc54a\ub2e4.", "localization_tags": [], "locale": "ko", "last_edit": "2014-07-06T09:18:30", "review_tags": []}, {"title": "\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u044c\u044e", "url": "/ru/docs/Web/JavaScript/Memory_Management", "tags": [], "summary": "\u041d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, C) \u0438\u043c\u0435\u044e\u0442 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a\u00a0malloc()
\u00a0\u0438\u00a0free()
. \u0412 JavaScript \u0436\u0435 \u043f\u0430\u043c\u044f\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 (\u0442.\u0435., \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432, \u0441\u0442\u0440\u043e\u043a \u0438 \u0442.\u043f.) \u0438 \"\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\" \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f\n\n \u0441\u0431\u043e\u0440\u043a\u043e\u0439 \u043c\u0443\u0441\u043e\u0440\u0430\n . \u0421\u043b\u043e\u0432\u043e \"\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\" \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u043f\u0443\u0442\u0430\u043d\u0438\u0446\u044b \u0438 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u043d\u0430 JavaScript (\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 \u044f\u0437\u044b\u043a\u0430\u0445) \u043b\u043e\u0436\u043d\u043e\u0435 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u0430\u043c\u044f\u0442\u044c\u044e.", "localization_tags": [], "locale": "ru", "last_edit": "2015-04-22T09:16:11", "review_tags": []}, {"title": "\u5185\u5b58\u7ba1\u7406", "url": "/zh-CN/docs/Web/JavaScript/Memory_Management", "tags": [], "summary": "\u4f4e\u7ea7\u8bed\u8a00\uff0c\u6bd4\u5982C\uff0c\u6709\u4f4e\u7ea7\u7684\u5185\u5b58\u7ba1\u7406\u57fa\u5143\uff0c\u50cfmalloc(),free()\u3002\u53e6\u4e00\u65b9\u9762\uff0cJavaScript\u7684\u5185\u5b58\u57fa\u5143\u5728\u53d8\u91cf\uff08\u5bf9\u8c61\uff0c\u5b57\u7b26\u4e32\u7b49\u7b49\uff09\u521b\u5efa\u65f6\u5206\u914d\uff0c\u7136\u540e\u5728\u4ed6\u4eec\u4e0d\u518d\u88ab\u4f7f\u7528\u65f6\u201c\u81ea\u52a8\u201d\u91ca\u653e\u3002\u540e\u8005\u88ab\u79f0\u4e3a\u5783\u573e\u56de\u6536\u3002\u8fd9\u4e2a\u201c\u81ea\u52a8\u201d\u662f\u6df7\u6dc6\u5e76\u7ed9JavaScript\uff08\u548c\u5176\u4ed6\u9ad8\u7ea7\u8bed\u8a00\uff09\u5f00\u53d1\u8005\u4e00\u4e2a\u9519\u89c9\uff1a\u4ed6\u4eec\u53ef\u4ee5\u4e0d\u7528\u8003\u8651\u5185\u5b58\u7ba1\u7406\u3002", "localization_tags": [], "locale": "zh-CN", "last_edit": "2014-09-24T00:53:41", "review_tags": []}, {"title": "Speicherverwaltung", "url": "/de/docs/Web/JavaScript/Speicherverwaltung", "tags": ["JavaScript"], "summary": "Bei Low-Level Programmiersprachen wie C, die zur systemnahen Programmierung eingesetzt werden, existieren Funktionen - wie z. B. malloc()
und free()
- womit explizit Speicher angefordert und wieder freigegeben werden kann. Bei JavaScript gibt es keine solchen Funktionen, sondern der ben\u00f6tigte Speicher wird bei der Erzeugung neuer Objekte (z. B. benutzerdefinierte Objekte oder vordefinierte Objekte wie String
) zugewiesen. Die Speicherfreigabe erfolgt automatisch im Hintergrund durch die Garbage Collection (w\u00f6rtlich: \"M\u00fcllabfuhr\"; automatische Speicherbereinigung). Dieser Automatismus f\u00fchrt oft zu Verwirrung und l\u00e4sst so manchen Entwicklern irrt\u00fcmlich glauben, man m\u00fcsse sich \u00fcber die Speicherverwaltung keine Gedanken machen.", "localization_tags": [], "locale": "de", "last_edit": "2014-09-28T07:29:12", "review_tags": []}, {"title": "Gestion de la m\u00e9moire", "url": "/fr/docs/Web/JavaScript/Gestion_de_la_m%C3%A9moire", "tags": ["memory", "JavaScript"], "summary": "Quel que soit le langage de programmation, le cycle de vie de la m\u00e9moire ressemblera \u00e0 :", "localization_tags": [], "locale": "fr", "last_edit": "2015-04-12T04:38:24", "review_tags": []}, {"title": "\u09ae\u09c7\u09ae\u09cb\u09b0\u09bf \u09ac\u09cd\u09af\u09ac\u09b8\u09cd\u09a5\u09be\u09aa\u09a8\u09be", "url": "/bn-BD/docs/Web/JavaScript/Memory_Management", "tags": ["memory", "JavaScript"], "summary": "\u09b2\u09cb-\u09b2\u09c7\u09ad\u09c7\u09b2\u09c7\u09b0 \u09ad\u09be\u09b7\u09be, \u09af\u09c7\u09ae\u09a8 C, \u09a4\u09c7 \u09aa\u09cd\u09b0\u09be\u099a\u09c0\u09a8 \u0986\u09ae\u09b2\u09c7\u09b0 \u09ae\u09c7\u09ae\u09cb\u09b0\u09bf \u09ac\u09cd\u09af\u09ac\u09b8\u09cd\u09a5\u09be\u09aa\u09a8\u09be \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09be \u09b9\u09df\u0964 \u09af\u09c7\u09ae\u09a8\u0983 malloc()
\u098f\u09ac\u0982 free()
\u0964 \u0985\u09a8\u09cd\u09af\u09a6\u09bf\u0995\u09c7, \u099c\u09be\u09ad\u09be\u09b8\u09cd\u0995\u09cd\u09b0\u09bf\u09aa\u09cd\u099f\u09c7\u09b0 \u09ad\u09cd\u09af\u09be\u09b2\u09c1 (\u0985\u09ac\u099c\u09c7\u0995\u09cd\u099f, \u09b8\u09cd\u099f\u09cd\u09b0\u09bf\u0982 \u0987\u09a4\u09cd\u09af\u09be\u09a6\u09bf) \u09a4\u09c8\u09b0\u09bf\u09b0 \u09b8\u09ae\u09df \"\u09b8\u09cd\u09ac\u09df\u0982\u0995\u09cd\u09b0\u09bf\u09df\" \u09ad\u09be\u09ac\u09c7 \u09ae\u09c7\u09ae\u09cb\u09b0\u09bf \u09a6\u0996\u09b2 \u0995\u09b0\u09c7 \u098f\u09ac\u0982 \u09af\u0996\u09a8 \u09ac\u09be\u09ac\u09b9\u09c3\u09a4 \u09b9\u09df\u09a8\u09be, \u09a4\u0996\u09a8 \u09b8\u09cd\u09a5\u09be\u09a8 \u099b\u09c7\u09dc\u09c7 \u09a6\u09c7\u09df\u0964 \u0985\u09ac\u09cd\u09af\u09ac\u09b9\u09c3\u09a4 \u09ae\u09c7\u09ae\u09cb\u09b0\u09bf \u099b\u09c7\u09dc\u09c7 \u09a6\u09c7\u09df\u09be\u09b0 \u09aa\u09cd\u09b0\u0995\u09cd\u09b0\u09bf\u09df\u09be\u099f\u09bf\u0995\u09c7 \u09ac\u09b2\u09be \u09b9\u09df \u0986\u09ac\u09b0\u09cd\u099c\u09a8\u09be \u09b8\u0982\u0997\u09cd\u09b0\u09b9 \u09ac\u09be garbage collection\u0964 \u098f\u0987 \"\u09b8\u09cd\u09ac\u09df\u0982\u0995\u09cd\u09b0\u09bf\u09df\" \u09ac\u09cd\u09af\u09be\u09aa\u09be\u09b0\u099f\u09bf \u098f\u0995\u099f\u09bf \u09ac\u09bf\u09ad\u09cd\u09b0\u09be\u09a8\u09cd\u09a4\u09bf\u09b0 \u0989\u09ce\u09b8 \u098f\u09ac\u0982 \u098f\u099f\u09bf \u099c\u09be\u09ad\u09be\u09b8\u09cd\u0995\u09cd\u09b0\u09bf\u09aa\u09cd\u099f (\u098f\u09ac\u0982 \u0985\u09a8\u09cd\u09af\u09be\u09a8\u09cd\u09af \u09b9\u09be\u0987-\u09b2\u09c7\u09ad\u09c7\u09b2\u09c7\u09b0 \u09ad\u09be\u09b7\u09be\u09b0) \u09a1\u09c7\u09ad\u09c7\u09b2\u09aa\u09be\u09b0\u09a6\u09c7\u09b0 \u098f\u09ae\u09a8 \u0985\u09a8\u09c1\u09ad\u09c2\u09a4 \u09b9\u09df \u09af\u09c7, \u09ae\u09c7\u09ae\u09cb\u09b0\u09bf \u09ae\u09cd\u09af\u09be\u09a8\u09c7\u099c\u09ae\u09c7\u09a8\u09cd\u099f \u09a8\u09bf\u09df\u09c7 \u099a\u09bf\u09a8\u09cd\u09a4\u09be \u0995\u09b0\u09be\u09b0 \u09a6\u09b0\u0995\u09be\u09b0 \u09a8\u09c7\u0987\u0964 \u098f\u099f\u09be \u09ad\u09c1\u09b2\u0964", "localization_tags": [], "locale": "bn-BD", "last_edit": "2015-04-26T05:54:49", "review_tags": []}, {"title": "Gesti\u00f3n de Memoria", "url": "/es/docs/Web/JavaScript/Gestion_de_Memoria", "tags": [], "summary": "Los lenguajes de bajo nivel, como C, tienen primitivos de bajo nivel como malloc()
y free()
para la gesti\u00f3n de memoria. Por otro lado, los valores en javascript son reservados cuando las cosas (objetos, strings, etc.) son creados y \"automaticamente\" liberados cuando ya no son utilizados. El proceso anterior es conocido como Recolecci\u00f3n\u00a0de basura (garbage collection).\u00a0Su forma \"automatica\" es fuente de confusi\u00f3n y le da la impresi\u00f3n a los desarrolladores de JavaScript (y de otros lenguajes de alto nivel) de poder ignorar el proceso de gesti\u00f3n de memoria. Esto es equivocado.", "localization_tags": ["inprogress"], "locale": "es", "last_edit": "2015-02-22T11:56:31", "review_tags": []}, {"title": "Memory Management", "url": "/it/docs/Web/JavaScript/Gestione_della_Memoria", "tags": [], "summary": "Low-level languages, like C, have low-level memory management primitives like malloc()
and free()
. On the other hand, JavaScript values are allocated when things (objects, strings, etc.) are created and \"automatically\" free'd when they are not used anymore. The latter process is called garbage collection. This \"automatically\" is a source of confusion and gives JavaScript (and high-level languages) developers the impression they can decide not to care about memory management. This is a mistake.", "localization_tags": ["inprogress"], "locale": "it", "last_edit": "2015-03-27T15:23:58", "review_tags": []}, {"title": "Memory Management", "url": "/ja/docs/Web/JavaScript/Memory_Management", "tags": ["memory", "JavaScript"], "summary": "C\u306e\u3088\u3046\u306a\u4f4e\u30ec\u30d9\u30eb\u8a00\u8a9e\u306f\u3001malloc()
\u3084free()
\u306e\u3088\u3046\u306a\u5e95\u30ec\u30d9\u30eb\u30e1\u30e2\u30ea\u7ba1\u7406\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u3092\u6301\u3061\u307e\u3059\u3002\u4ed6\u65b9\u3067\u306f\u3001JavaScript\u306e\u5024\u306f\u3001\u3082\u306e(\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3001\u6587\u5b57\u5217\u306a\u3069)\u304c\u751f\u6210\u3055\u308c\u308b\u3068\u304d\u306b\u5272\u308a\u5f53\u3066\u3089\u308c\u307e\u3059\u3002\u305d\u3057\u3066\u3001\"\u81ea\u52d5\u7684\u306b\"\u4f7f\u7528\u3055\u308c\u306a\u3044\u3068\u304d\u958b\u653e\u3055\u308c\u307e\u3059\u3002\u5f8c\u8005\u306e\u30d7\u30ed\u30bb\u30b9\u304c\u30ac\u30fc\u30d9\u30b8\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002\u3053\u306e\"\u81ea\u52d5\u7684\"\u306f\u6df7\u4e71\u306e\u6e90\u3067\u3042\u308a\u3001JavaScript (\u305d\u3057\u3066\u3001\u9ad8\u30ec\u30d9\u30eb\u8a00\u8a9e) \u958b\u767a\u8005\u306b\u5f7c\u3089\u306f\u3001\u30e1\u30e2\u30ea\u7ba1\u7406\u3092\u6c17\u306b\u3057\u306a\u3044\u3053\u3068\u3092\u6c7a\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u5370\u8c61\u3092\u4e0e\u3048\u307e\u3059\u3002\u3053\u308c\u306f\u8aa4\u308a\u3067\u3059\u3002", "localization_tags": ["inprogress"], "locale": "ja", "last_edit": "2015-06-10T23:43:23", "review_tags": ["editorial"]}], "modified": "2015-07-19T23:28:48", "label": "Gerenciamento de Mem\u00f3ria", "localization_tags": [], "url": "/pt-BR/docs/Web/JavaScript/Memory_Management", "last_edit": "2015-07-19T23:28:43", "summary": "Linguagens de baixo n\u00edvel, como C, tem primitivas de gerenciamento de mem\u00f3ria de baixo n\u00edvel como\u00a0malloc()
e free()
. Em contrapartida, os valores do JavaScript s\u00e3o alocados quando coisas\u00a0(objetos, strings, etc.) s\u00e3o criadas e \"automaticamente\" liberadas quando n\u00e3o s\u00e3o mais usadas. Este \u00faltimo processo se chama\u00a0garbage collection. Facilmente se torna uma fonte de confus\u00e3o e d\u00e1 a impress\u00e3o aos desenvolvedores JavaScript (e outras linguagens de auto n\u00edvel)\u00a0que eles n\u00e3o precisam se preocupar com o consumo de mem\u00f3ria. Isto \u00e9 um erro.", "sections": [{"id": "Quick_Links", "title": null}, {"id": "Introdu\u00e7\u00e3o", "title": "Introdu\u00e7\u00e3o"}, {"id": "Ciclo_de_vida_da_mem\u00f3ria", "title": "Ciclo de vida da mem\u00f3ria"}, {"id": "Aloca\u00e7\u00e3o_no_JavaScript", "title": "Aloca\u00e7\u00e3o no JavaScript"}, {"id": "Inicializa\u00e7\u00e3o_de_valor", "title": "Inicializa\u00e7\u00e3o de valor"}, {"id": "Aloca\u00e7\u00e3o_via_chamada_de_uma_fun\u00e7\u00e3o", "title": "Aloca\u00e7\u00e3o via chamada de uma fun\u00e7\u00e3o"}, {"id": "Utiliza\u00e7\u00e3o_de_valores", "title": "Utiliza\u00e7\u00e3o de\u00a0valores"}, {"id": "Libere_quando_a_mem\u00f3ria_n\u00e3o_for_mais_necess\u00e1ria", "title": "Libere quando a mem\u00f3ria n\u00e3o for mais necess\u00e1ria"}, {"id": "Garbage_collection", "title": "Garbage collection"}, {"id": "Refer\u00eancias", "title": "Refer\u00eancias"}, {"id": "Refer\u00eancia_de_contagem_do_garbage_collection", "title": "Refer\u00eancia de contagem do garbage collection"}, {"id": "Exemplo", "title": "Exemplo"}, {"id": "Limita\u00e7\u00e3o_ciclos", "title": "Limita\u00e7\u00e3o : ciclos"}, {"id": "Exemplo_da_vida_real", "title": "Exemplo da vida real"}, {"id": "Algoritmo_de_varredura_e_rotula\u00e7\u00e3o", "title": "Algoritmo de varredura e rotula\u00e7\u00e3o"}, {"id": "Ciclos_n\u00e3o_s\u00e3o_mais_um_problema", "title": "Ciclos n\u00e3o s\u00e3o mais um problema"}, {"id": "Limita\u00e7\u00e3o_objetos_devem_ser_feitos_explicitamente_inacess\u00edveis", "title": "Limita\u00e7\u00e3o: objetos devem ser feitos explicitamente inacess\u00edveis"}, {"id": "Veja_tamb\u00e9m", "title": "Veja tamb\u00e9m"}], "id": 135477, "review_tags": ["editorial"]}