• Quick Start
  • Booting
  • Platform
  • Portals
  • References
    • API Reference TOI3
    • IIP Reference
  • Resources
ARRIS Enterprises, Inc. Confidential Information

Memory Usage and Tips

  • System Memory
  • Browser and Cache

System Memory

What exactly happens when the free memory runs out?

The standard Linux Out Of Memory killer will engage when the value of the free and cached memory falls below a certain threshold, set in /proc/sys/vm/min_free_kbytes. This OOM Killer will terminate the process consuming the most memory (usually your C++ application, or the browser if running HTML/JavaScript middleware). The KreaTV OS will then restart the application/browser.

What is being reported by system free memory?

Linux can over-allocate the memory (optimistic allocation strategy - normal linux methods can be used to tweak this behaviour, see here) which results in an apparent success when allocating a large chunk of memory, but the memory is only actually allocated when the application begins to use it. Because of this and caching strategies, it is very difficult to get a precise value for the remaining free memory level. The only sure-fire way to know what memory is available to your application at a specific time is to allocate memory continuously, in small amounts, until the memory is completely full. You can use the kreatv-tool-allocmem IIP for this task.

How can a C++ app or JS portal determine (even approximately) how much free memory is currently available?

A C++ application can read memory information from /proc/meminfo.

A portal application can use the Profiler Service.

The kreatv-tool-allocmem IIP is a standalone tool to identify how much memory is actually available for allocation. It works by allocating small amounts at regular intervals until no more memory can be allocated. This is the recommended way to determine how much memory is actually available for allocation.

Browser and Cache

How does caching work in WebKit?

Ekioh-WebKit's cache holds subresources used by web pages: images, scripts, stylesheets, etc. The cache keeps a flexible but bounded window of dead resources that grows/shrinks depending on the live resource load. However, note that cache can only provide limited caching capabilities.

What arguments can be provided to control the behaviour?

The parameter "cache" on the kreatv-app-webkit-portal IIP defines how much memory the portal browser can use for cache.

5.1.1.p8

Copyright (c) 2018 ARRIS Enterprises, LLC. All Rights Reserved. ARRIS Enterprises, LLC. Confidential Information.