Buscar en Mind w/o Soul

martes, agosto 21, 2007

Javascript memory leaks

Cómo se producen pérdidas de memoria en IE al usar javascript

A (Re)-Introduction to JavaScript
Memory leaks #

An unfortunate side effect of closures is that they make it trivially easy to leak memory in Internet Explorer. JavaScript is a garbage collected language - objects are allocated memory upon their creation and that memory is reclaimed by the browser when no references to an object remain. Objects provided by the host environment are handled by that environment.

Browser hosts need to manage a large number of objects representing the HTML page being presented - the objects of the DOM. It is up to the browser to manage the allocation and recovery of these.

Internet Explorer uses its own garbage collection scheme for this, separate from the mechanism used by JavaScript. It is the interaction between the two that can cause memory leaks.

No hay comentarios: