maniacbug / MemoryFree

Arduino MemoryFree library. Hosting it on github for easy access
http://www.arduino.cc/playground/Code/AvailableMemory
63 stars 54 forks source link

freeMemory() return negative value #7

Open JungSangHyeon opened 4 years ago

JungSangHyeon commented 4 years ago

This is my code.

#include <Arduino_FreeRTOS.h>
#include "MemoryFree.h"

void setup() {
    Serial.begin(9600);
    Serial.print("\r\nStart / FM : ");
    Serial.println(freeMemory());

    xTaskCreate(Task1, "task1", 128, NULL, 1, NULL);

    Serial.print("After Create Task / FM : ");
    Serial.println(freeMemory());

    vTaskStartScheduler();
}

void Task1(void* pvParameters) {
    Serial.print("After Start Scheduler / FM : ");
    Serial.println(freeMemory());

    while (1) {
        Serial.print("Loop / FM : ");
        Serial.println(freeMemory());
        delay(100);
    }
}

void loop() {}

And Result

Start / FM : 7201
After Create Task / FM : 7028
After Start Scheduler / FM : -50
Loop / FM : -50
Loop / FM : -50
Loop / FM : -50
Loop / FM : -50
Loop / FM : -50
Loop / FM : -50
Loop / FM : -50
Loop / FM : -50
...
Woody363 commented 3 years ago

Same problem here, except I'm getting "-1720520" using Teensy 4.0. I suspect the library isn't compatible with teensy architecture?