Code Monkey home page Code Monkey logo

Comments (8)

nrwiersma avatar nrwiersma commented on May 24, 2024

Is there any reason you think this?

I would not imagine it would, the size of a class instantiation is the same, regardless of it is declared static or not.

from esp8266scheduler.

a-d-j-i avatar a-d-j-i commented on May 24, 2024

Just adding a task seems to take 4k ram space.

class MemPrinter: public Task {
public:
virtual ~MemPrinter() {
}
virtual void loop() {
Serial.println(ESP.getFreeHeap());
delay(2000);
}
};
MemPrinter mem_printer;
MemPrinter mem_printer2;
MemPrinter mem_printer3;
//MemPrinter mem_printer4;
void setup(void) {
Serial.begin(115200);
delay(100);
//Scheduler.start(&mem_printer);
Serial.println("Ready");
Serial.print(F("MEM END: "));
Serial.println(ESP.getFreeHeap());
//Scheduler.begin();
}
void loop(void) {
Serial.println(ESP.getFreeHeap());
delay(2000);
}

from esp8266scheduler.

nrwiersma avatar nrwiersma commented on May 24, 2024

Wow, 4k seems heavy for a class. I don't have my rig setup at the moment, I will have to look into this sometime this week.

Thanks for reporting.

from esp8266scheduler.

a-d-j-i avatar a-d-j-i commented on May 24, 2024

Probably part of the problem came from Task.context that is a cont_t that have a
stack[CONT_STACKSIZE / 4];
and
#ifndef CONT_STACKSIZE
#define CONT_STACKSIZE 4096
#endif
I'm going to investigate further...

from esp8266scheduler.

nrwiersma avatar nrwiersma commented on May 24, 2024

Thanks for looking into it.

If this is the case, there is unfortunately nothing to do about it. The cont_t is a critical part in being able to save and restore task context.

from esp8266scheduler.

nrwiersma avatar nrwiersma commented on May 24, 2024

I assume this is resolved. Please reopen if this is still an issue.

from esp8266scheduler.

dbuezas avatar dbuezas commented on May 24, 2024

This maybe explains why I get a OOM error in the console (activated debug for SSL+HTMLClient) when making "heavy" use of the library.

  • Without using the library (obviously no multitasking) have 36440 bytes free in the heap before connecting to the host
  • With 5 tasks running, I measure 11008 (25k less) and the connection cannot be made.

My 5 tasks plus the main task exactly matches the bill (6*4k=24k). Does this sound correct to you?
I guess I'll have to try to reduce it to 2 tasks, which is a pity, the code was looking so elegant.

from esp8266scheduler.

nrwiersma avatar nrwiersma commented on May 24, 2024

Yes, that seem about right.

from esp8266scheduler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.