# SAP HANA Global Allocation Limit Calculator

> Source: https://netray.co/tools/sap-hana-global-allocation-limit-calculator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Calculate the default HANA 2.0 memory allocation limit for your RAM, the MB value to set when reserving memory, tenant limits and statement memory exposure.

## Category

sap

## Erp

SAP HANA

## Audience

- SAP Basis administrator
- HANA DBA

## Tool

**Kind:** calculator

**Inputs:**

#### Physical RAM of the host

**Key:** ram

**Type:** slider

**Default:** 512

**Min:** 32

**Max:** 12288

**Step:** 32

**Unit:** GB

#### Number of tenant databases

**Key:** tenants

**Type:** number

**Default:** 1

**Min:** 1

**Max:** 20

**Step:** 1

#### Share of limit for the main tenant

**Key:** pct

**Type:** number

**Default:** 90

**Min:** 1

**Max:** 100

**Step:** 1

**Unit:** %

#### Memory reserved for other software

**Key:** reserve

**Type:** number

**Default:** 0

**Min:** 0

**Step:** 8

**Unit:** GB

**Help:** ABAP app server, second HANA instance or other software on the same host.

#### statement_memory_limit

**Key:** stmt

**Type:** number

**Default:** 0

**Min:** 0

**Step:** 1

**Unit:** GB

**Help:** 0 = not set.

#### Concurrent heavy statements

**Key:** heavy

**Type:** number

**Default:** 5

**Min:** 0

**Max:** 200

**Step:** 1

**Outputs:**

#### Default allocation limit

**Key:** gal_default

**Expr:** 0.9 * min(ram, 64) + 0.97 * max(ram - 64, 0)

**Format:** number

**Primary:** true

**Description:** GB. HANA 2.0 default when global_allocation_limit = 0: 90% of the first 64 GB plus 97% of the rest.

#### Allocation limit with reserve

**Key:** gal_adj

**Expr:** min(gal_default, ram - reserve)

**Format:** number

**Description:** GB.

#### global_allocation_limit value to set

**Key:** gal_mb

**Expr:** round(gal_adj * 1024)

**Format:** integer

**Description:** MB, global.ini [memorymanager]. Only set it if you need less than the default.

#### Main tenant allocationlimit

**Key:** tenant_mb

**Expr:** round(gal_adj * pct / 100 * 1024)

**Format:** integer

**Description:** MB.

#### Memory exposure of heavy statements

**Key:** stmt_total

**Expr:** stmt * heavy

**Format:** number

**Description:** GB if all heavy statements reach statement_memory_limit at once.

#### Share of tenant limit

**Key:** stmt_share

**Expr:** if(gt(gal_adj * pct / 100, 0), stmt_total / (gal_adj * pct / 100) * 100, 0)

**Format:** percent

**Chart:**

#### Default allocation limit vs RAM

**Type:** line

**X:** ram

**From:** 32

**To:** 2048

**Steps:** 32

**Series:**

- gal_default

**Disclaimer:** Default formula as documented for SAP HANA 2.0 (see SAP Note 1999997 and the Administration Guide topic on the memory allocation limit). Older revisions used a different default. Confirm for your revision.

## Content

**Intro:** The global allocation limit caps how much memory an SAP HANA instance may allocate on a host. This calculator shows the HANA 2.0 default for your RAM, the MB value to set if other software shares the host, a tenant allocationlimit and how much memory concurrent statements could claim under statement_memory_limit.

**Sections:**

#### How to use it

**Body:** Enter the physical RAM of the host. If an ABAP application server, a second HANA instance or anything else runs on the same host, enter the memory it needs as the reserve. The primary output is the default limit HANA uses when global_allocation_limit is 0. If the reserve pushes the limit below that default, set global_allocation_limit to the MB value shown. For multitenant systems enter the share the main tenant should get. Finally enter statement_memory_limit and how many heavy statements may run at once to see whether those statements alone could exhaust the tenant.

**Bullets:**

- Leave global_allocation_limit at 0 on a dedicated host
- Limits of co-located instances must add up below physical RAM
- Check the effective value in M_HOST_RESOURCE_UTILIZATION (ALLOCATION_LIMIT)

#### Where the parameters live

**Body:** global_allocation_limit is in the [memorymanager] section of global.ini and is set in MB. With the default value 0, HANA 2.0 uses 90 percent of the first 64 GB of physical memory plus 97 percent of the remaining memory. A tenant limit is the allocationlimit parameter in the same section at DATABASE layer, for example ALTER SYSTEM ALTER CONFIGURATION ('global.ini', 'DATABASE', 'PRD') SET ('memorymanager', 'allocationlimit') = '427622' WITH RECONFIGURE; run from SYSTEMDB. statement_memory_limit (GB) caps memory per statement, and statement_memory_limit_threshold (percent of the global limit) makes it apply only when total memory use is above that threshold. All of these are online changes.

**Bullets:**

- global_allocation_limit: MB, [memorymanager]
- allocationlimit: MB, per tenant, DATABASE layer
- statement_memory_limit: GB; statement_memory_limit_threshold: percent

#### Worked example

**Body:** A 512 GB host: 0.9 x 64 = 57.6 GB plus 0.97 x 448 = 434.6 GB, a default limit of about 492 GB. If an ABAP app server on the same host needs 48 GB, the limit must not exceed 464 GB, so set global_allocation_limit = 475136 MB. Give the main tenant 90 percent: about 427,622 MB. With statement_memory_limit = 50 GB and five heavy statements, those statements alone could take 250 GB, more than half the tenant, which is a sign to lower the per-statement limit or control concurrency with workload classes.

#### Out-of-memory errors and gotchas

**Body:** When a request cannot be satisfied within the limit, HANA returns SQL error 4, cannot allocate enough memory, and writes an OOM dump trace. A statement hitting statement_memory_limit is cancelled with a memory limit error rather than crashing others. Raising the global limit above physical memory does not create memory, it invites operating system swapping. Remember that the limit includes code, stack and shared memory, not only table data, so the column store must fit inside the limit with room for working memory. Use M_SERVICE_MEMORY and M_HEAP_MEMORY to see where memory goes before changing limits.

**Cta:** If you want your Basis team to ask why HANA ran out of memory and which statements caused it, in plain English on your own servers, we can set that up.

**Faq:**

#### What is the default SAP HANA memory allocation limit?

**Answer:** In HANA 2.0, with global_allocation_limit = 0, the default is 90 percent of the first 64 GB of physical memory plus 97 percent of the rest. On a 1 TB host that is roughly 989 GB. Older revisions used a simpler percentage, so check the documentation for your revision.

#### Is global_allocation_limit in GB or MB?

**Answer:** MB. Set it in the [memorymanager] section of global.ini, normally at SYSTEM layer, for example 475136 for 464 GB. The tenant allocationlimit is also MB. statement_memory_limit, by contrast, is in GB, which is a common source of mistakes.

#### How does hana statement memory limit work?

**Answer:** statement_memory_limit caps the memory a single statement may use on a host. If statement_memory_limit_threshold is set, the cap only applies when total memory use exceeds that percentage of the global limit. A statement that exceeds it is cancelled. Workload classes can set per-class limits instead.

#### Can two HANA instances share one host?

**Answer:** Yes, if supported for your scenario, but set global_allocation_limit on each instance so the total stays below physical memory with room for the OS. Otherwise both instances assume they can use most of the RAM and the host will swap or hit OOM.

## Search terms

sap hana memory allocation limit, sap hana memory limit, hana statement memory limit, hana db memory parameters, sap hana memory configuration, global_allocation_limit, hana tenant memory limit

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
