Skip to content

Commit 41bbd46

Browse files
author
Amanda Butler
authored
Merge pull request #684 from kegilbert/memory-tracing-enabled-configopt-patch
Move mem_tracing from macro setting to using the MbedOS Config Settings
2 parents 821fb25 + 6881189 commit 41bbd46

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

docs/reference/api/platform/MemTrace.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
Mbed OS provides a set of functions that you can use to study the runtime memory allocation pattern of your software: which sections of the code allocate and free memory and how much memory they need.
44

5-
You must define the `MBED_MEM_TRACING_ENABLED` macro to enable memory tracing.
5+
You must enable the `memory-tracing-enabled` setting in the Mbed OS platform configuration options to enable memory tracing. We recommend doing this by adding it to your `mbed_app.json`:
6+
7+
```
8+
{
9+
"target_overrides": {
10+
"*": {
11+
"platform.memory-tracing-enabled": true
12+
}
13+
}
14+
}
15+
```
616

717
You can use the `mbed_mem_trace_set_callback` API to set the callback for memory tracing. The callback is invoked every time you call standard allocation functions, such as `malloc`, `realloc`, `calloc` and `free`.
818

@@ -16,6 +26,6 @@ For a step-by-step guide about how to use optimize memory using runtime memory t
1626

1727
[![View code](https://www.mbed.com/embed/?url=https://os.mbed.com/teams/mbed_example/code/memory_tracing_example/)](https://os.mbed.com/teams/mbed_example/code/memory_tracing_example/file/168ab14e6694/main.cpp)
1828

19-
### Related content
29+
### Related content
2030

2131
- [Runtime memory tracing tutorial](/docs/development/tutorials/optimizing.html#runtime-memory-tracing).

docs/tutorials/optimize/memory/runtime_mem_trace.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ Running out of memory is a common problem with resource constrained systems such
44

55
#### Using the memory tracer
66

7-
The memory tracer is not enabled by default. To enable it, you need to define the **`MBED_MEM_TRACING_ENABLED`** macro. The recommended way to define this macro is to add it to the list of macros defined in your `mbed_app.json`:
7+
The memory tracer is not enabled by default. To enable it, you need to enable the **`memory-tracing-enabled`** setting in the Mbed OS platform configuration options. We recommend doing this by add it to your `mbed_app.json`:
88

99
```
1010
{
11-
"macros": ["MBED_MEM_TRACING_ENABLED"]
11+
"target_overrides": {
12+
"*": {
13+
"platform.memory-tracing-enabled": true
14+
}
15+
}
1216
}
1317
```
1418

0 commit comments

Comments
 (0)