Questions about ExtMem window mapping and EXTMEMPOLICY behavior
Posted: Mon Aug 24, 2026 12:50 pm
Hi everyone,
I have been experimenting with the ExtMem API, especially the Map() function and the concept of using a “window” inside Exec RAM to access parts of an ExtMem allocation. While testing, I ran into a few points that I’m not entirely sure how to interpret, so I wanted to ask for clarification.
1. What exactly is the purpose of the baseAddr parameter in Map()?
The autodoc says that Map(baseAddr, length, offset, flags) can take a non‑NULL baseAddr.
What I’m not sure about is:
- Is baseAddr supposed to be a pre‑allocated Exec RAM buffer that the ExtMem system will use as the window?
- Or is it only a hint/request, and the implementation may choose to allocate its own window elsewhere?
- If the caller must allocate the window buffer manually, is this documented anywhere?
In my tests, passing a manually allocated 1 MB Exec RAM block as baseAddr did not result in Map() returning that same address. Instead, Map() returned a different Exec RAM pointer. So I’m wondering whether I misunderstood the intended usage.
2. Are the EXTMEMPOLICY_* flags documented somewhere?
I could not find detailed documentation for:
- EXTMEMPOLICY_IMMEDIATE
- EXTMEMPOLICY_DELAYED
- EXTMEMPOLICY_ACCESS
From testing, the behavior seems quite different depending on the policy, so it would be helpful to know what the intended semantics are.
3. Observation regarding EXTMEMPOLICY_IMMEDIATE
This is just an observation, not a conclusion:
When allocating an ExtMem object with EXTMEMPOLICY_IMMEDIATE, the amount of available Exec RAM (as shown by Avail) decreases by the full size of the ExtMem allocation. For example, allocating 128 MB of ExtMem reduces Exec RAM by roughly 128 MB before any window is mapped.
With EXTMEMPOLICY_DELAYED, this does not happen; only a small amount of Exec RAM is used (in my case about 2 MB: 1 MB for my own window buffer and ~1 MB for an internal ExtMem window).
Is this expected behavior for IMMEDIATE?
Thanks in advance for any clarification.
I have been experimenting with the ExtMem API, especially the Map() function and the concept of using a “window” inside Exec RAM to access parts of an ExtMem allocation. While testing, I ran into a few points that I’m not entirely sure how to interpret, so I wanted to ask for clarification.
1. What exactly is the purpose of the baseAddr parameter in Map()?
The autodoc says that Map(baseAddr, length, offset, flags) can take a non‑NULL baseAddr.
What I’m not sure about is:
- Is baseAddr supposed to be a pre‑allocated Exec RAM buffer that the ExtMem system will use as the window?
- Or is it only a hint/request, and the implementation may choose to allocate its own window elsewhere?
- If the caller must allocate the window buffer manually, is this documented anywhere?
In my tests, passing a manually allocated 1 MB Exec RAM block as baseAddr did not result in Map() returning that same address. Instead, Map() returned a different Exec RAM pointer. So I’m wondering whether I misunderstood the intended usage.
2. Are the EXTMEMPOLICY_* flags documented somewhere?
I could not find detailed documentation for:
- EXTMEMPOLICY_IMMEDIATE
- EXTMEMPOLICY_DELAYED
- EXTMEMPOLICY_ACCESS
From testing, the behavior seems quite different depending on the policy, so it would be helpful to know what the intended semantics are.
3. Observation regarding EXTMEMPOLICY_IMMEDIATE
This is just an observation, not a conclusion:
When allocating an ExtMem object with EXTMEMPOLICY_IMMEDIATE, the amount of available Exec RAM (as shown by Avail) decreases by the full size of the ExtMem allocation. For example, allocating 128 MB of ExtMem reduces Exec RAM by roughly 128 MB before any window is mapped.
With EXTMEMPOLICY_DELAYED, this does not happen; only a small amount of Exec RAM is used (in my case about 2 MB: 1 MB for my own window buffer and ~1 MB for an internal ExtMem window).
Is this expected behavior for IMMEDIATE?
Thanks in advance for any clarification.