Hardware Resource Management

This topic describes the hardware resource requirements for Samsung TV applications and the available tools that help you develop applications that use HW resources efficiently.

Principles

Samsung TV resources, including memory, are shared by the operating system and multiple applications. Efficient resource management helps maintain a stable and responsive TV experience when users launch and use applications, and switch between them.

Design each application feature to allocate resources only when needed, and release them as soon as they are no longer required. Test your application on target TV devices and monitor resource usage throughout development, especially when implementing media playback, a graphic-intensive UI, or large content lists.

Memory Usage Requirements (DDR)

All TV applications must comply with the specific memory usage requirements defined for the product models on which the application can be installed. Before submitting your application for release, ensure that your application does not exceed the applicable memory usage limits.

Applications that exceed the applicable memory usage limits may be subject to optimization measures as necessary to help maintain platform stability.

The application's memory usage is calculated as the combined total of the following memory components:

  • PSS (Proportional Set Size)
    Amount of application memory currently resident in RAM. Any memory shared with other processes is divided proportionally among the processes that share it.

  • SWAP
    Amount of application memory that has been compressed and moved to another RAM-backed storage area to free up RAM. This value represents the memory usage before compression.

  • GPU memory
    Memory used by the GPU to render the application’s UI, textures, and display output.

  • GEM memory
    Graphics buffer memory used for display output and graphic processing.

The following table defines the limits for the application's combined total PSS, SWAP, GPU memory, and GEM memory usage on specific TV models.

Product model

Maximum memory usage

UHD model

380 MB

FHD model

300 MB

Table 1: DRR memory usage limits

Memory Usage Requirements (Flash)

TV applications must manage flash memory usage according to the storage usage targets defined in this guide. Efficient flash memory management helps maintain sufficient storage for application updates, user data, and other TV services.

Flash memory usage is divided into the following categories:

  • Install memory
    Flash storage used when the application is installed, including the application binary and bundled resources.

  • Data memory
    Additional flash storage used while the application is running, including resources and data downloaded from a server.

The following table defines the recommended flash memory usage targets for TV applications.

Memory type

Recommended maximum usage

Install memory

5 MB

Data memory

20 MB

Table 2: Flash memory usage limits

Currently, the above targets are not mandatory certification requirements.However, applications are strongly encouraged to remain within the targets. If an application exceeds a target, optimization measures may be taken as necessary to help maintain platform stability.

Memory Management API

The Memory Management API enables applications to check their current memory usage, applicable memory limit, and remaining available memory at runtime. Use the API during development and testing to identify memory growth early and verify that your application remains within the applicable limits.

The following table lists the methods available in the Memory Management API.

Method

Description

Use case

getVersion()

Returns the version of the PMS API.

Check whether the required API version is supported on the target device.

getWebAppMemoryUsage(procName)

Returns the current total memory usage of the specified Web application. The total is calculated from the PSS, SWAP, GPU memory, and GEM memory.

Monitor the application's memory usage at runtime.

getWebAppMemoryLimit(procName)

Returns the maximum memory limit allowed for the specified Web application.

Check the applicable memory limit before or during resource-intensive operations.

setMemoryUsageCallback(callback, procName)

Registers a callback that fires when the web application exceeds its memory threshold. The callback occurs only once every 20 seconds at most.

Detect memory pressure and determine whether the application is approaching its memory limit.

unsetMemoryUsageCallback()

Unregisters the previously set memory usage callback and stops polling.

Unregister the callback when the application is terminated or you no longer need the polling.

Table 3: Memory management methods

Check the API version before using a feature, especially when supporting multiple TV model years or platform versions. Use the other methods at meaningful points in the application lifecycle, such as after initial loading, while navigating content-heavy screens, before and after playback, and when the application returns from the background.

Memory Monitoring

Web Inspector is a monitoring tool that helps you investigate your Web application's memory behavior during development.

Use Web Inspector to investigate and optimize your Web application's memory behavior. On the Profiles tab, you can examine JavaScript heap and memory allocation profiles and identify potential sources of unnecessary memory consumption, such as unreleased JavaScript objects, excessive DOM nodes, and retained resources.

Web Inspector provides Web runtime analysis only and does not provide a complete view of the application's total system memory usage. Measurements can differ between the TV emulator and an actual Samsung TV. In addition, Web Inspector cannot capture memory usage during application initialization because the application launches before Web Inspector starts. To verify the application's total memory usage and compliance with the memory usage requirements, test on a target TV device and use the Memory Management API.

Memory Optimization Guide

Memory optimization is an ongoing activity during application development, not a separate task to perform only after a memory issue occurs.

When designing, implementing, and testing your application, follow the Web App (HTML5) Memory Optimization Guide . It provides practical recommendations based on common memory issues found in TV Web applications, including patterns identified through application quality support. It covers image and graphics memory, DOM and list virtualization, memory leak prevention, JavaScript and garbage collection, media buffering, data and cache handling, and Canvas, WebGL, Web Audio, and Web Worker usage.

Use the guide to identify unnecessary resource retention, reduce peak memory usage, and improve long-running application's stability. The guide is provided as a best-practice reference and must be used together with the applicable memory usage requirements and the Memory Management API.