top

Managing Memory

Published 2014-10-27 | (Compatible with SDK 2.5,3.5,4.5,5.0,5.1 and 2011,2012,2013,2014 models)

Managing Memory

If you keep changing innerHTML and creating the XMLHttpRequest object, your TV memory runs out and applications installed in your TV will not run normally.

This is because garbage collectors do not always work as well as they should, and because TVs have limited memory compared to a computer.

To create optimized applications that run normally:

Use XHR communication correctly
If you wish to create and use XHR objects repeatedly in Samsung TVs, you will be faced with a problem of your applications working in a wrong way. For a better approach, see the SSO XHR communication example.
Free up memory
If the content in the tag is replaced with the innerHTML property, the corresponding node in the DOM tree is closed and a new one is created and connected. The closed node remains in the memory. If this occurs repeatedly, you may be faced with a memory full situation. The solution is to use the putInnerHTML() method of the Widget object in the common module. For more information about this method, see Common Modules.