Skip to content

Example sketches always report the same values? #3

Closed
@philj404

Description

@philj404

Hi. Thank you for publishing this library. I wanted to make something similar, but it was good to see you had a library already available!

Unfortunately, I have not been able to get MemoryUsage to report any changing values for the example sketches (or for my own sketches). I expected the examples to report changing values as storage was allocated and released. Am I using the library incorrectly?

My environment:

  • Windows 10 build computer
  • Arduino IDE 1.8.13
  • board family: "Arduino AVR Boards" v1.8.3
  • Board: "Arduino Uno"
  • Library: MemoryUsage v2.21.0 (fresh today)

I tried to run the example sketches "FreeRam" and "Stack".

NOTE 1:
The MemoryUsage examples are under File/Examples/INCOMPATIBLE/MemoryUsage...

  • Are these examples really incompatible with "Arduino Uno"?
  • I have other libraries compatible with the AVR architecture -- in these other libraries their library.properties files declare "architectures=avr" -- they declared "avr" in lower case. Should "avr" be declared lower case for MemoryUsage too?

The examples seemed to compile anyway.

NOTE 2: Stack.ino

Stack.ino builds with the following warning:

WARNING: library MemoryUsage claims to run on AVR architecture(s) and may be incompatible with your current board which runs on avr architecture(s).
C:\Users\philk\OneDrive\Documents\Arduino\libraries\MemoryUsage\src\MemoryUsage.cpp: In function 'uint16_t mu_StackCount()':
C:\Users\philk\OneDrive\Documents\Arduino\libraries\MemoryUsage\src\MemoryUsage.cpp:76:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (*p == STACK_CANARY && (int) p <= SP)
                                       ^
Sketch uses 5262 bytes (16%) of program storage space. Maximum is 32256 bytes.
Global variables use 286 bytes (13%) of dynamic memory, leaving 1762 bytes for local variables. Maximum is 2048 bytes.

The sketch output gives values that never change. For example stack size is always 1256 bytes:

Starting state of the memory:

Data start:256
Heap start:542
Heap end:542
Stack start:1047
Stack end:2303
Stack size:1256
Stack Maximum Size (Painting method): 1761


subPointer
Test string
Stack start:1047
Stack end:2303
Stack size:1256
Stack Maximum Size (Instrumentation method): 1256

subSmartPointer
Test string
Stack start:1047
Stack end:2303
Stack size:1256
Stack Maximum Size (Instrumentation method): 1256

subConstSmartPointer
Test string
Stack start:1047
Stack end:2303
Stack size:1256
Stack Maximum Size (Instrumentation method): 1256

subFull
Test string
Stack start:1047
Stack end:2303
Stack size:1256
Stack Maximum Size (Instrumentation method): 1256

subLocalData
10.00
Stack start:1047
Stack end:2303
Stack size:1256
Stack Maximum Size (Instrumentation method): 1256

Stack Maximum Size (Painting method): 1761


Ending state of the memory:

Data start:256
Heap start:542
Heap end:542
Stack start:1047
Stack end:2303
Stack size:1256

These values were supposed to change (at least temporarily), correct?

NOTE 3: FreeRam.ino

FreeRam.ino builds with the following warning:

WARNING: library MemoryUsage claims to run on AVR architecture(s) and may be incompatible with your current board which runs on avr architecture(s).
C:\Users\philk\OneDrive\Documents\Arduino\libraries\MemoryUsage\examples\FreeRam\FreeRam.ino: In function 'void setup()':
C:\Users\philk\OneDrive\Documents\Arduino\libraries\MemoryUsage\examples\FreeRam\FreeRam.ino:21:11: warning: unused variable 'p' [-Wunused-variable]
     byte *p = new byte[3000];
           ^
C:\Users\philk\OneDrive\Documents\Arduino\libraries\MemoryUsage\src\MemoryUsage.cpp: In function 'uint16_t mu_StackCount()':
C:\Users\philk\OneDrive\Documents\Arduino\libraries\MemoryUsage\src\MemoryUsage.cpp:76:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while (*p == STACK_CANARY && (int) p <= SP)
                                       ^
Sketch uses 2458 bytes (7%) of program storage space. Maximum is 32256 bytes.
Global variables use 192 bytes (9%) of dynamic memory, leaving 1856 bytes for local variables. Maximum is 2048 bytes.

The sketch output gives values that never change. For example the free RAM size is always 1850 bytes:

Starting state of the memory:

Data start:256
Heap start:448
Heap end:448
Stack start:2297
Stack end:2303
Heap size:0


Free Ram Size: 1850


Ending state of the memory:

Data start:256
Heap start:448
Heap end:448
Stack start:2297
Stack end:2303
Heap size:0


Free Ram Size: 1850

Again, these values were supposed to change (at least temporarily), correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions