Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
2 years ago. This question has been closed. Reason: Too broad - no single answer
How to limit memory used by a thread?
I have recently asked about Event Queue in this thread - https://os.mbed.com/questions/86071/How-to-end-an-event-queue/#answer16651.
This made me realise that I could potentially be creating up to 20 small threads, where the function I will be calling to be executed takes in a member of a class with 6 ints and a vector, and then uses those variables to send a message over CAN protocol.
My question is, if I will need to limit the 'space' my thread uses to get up to 20 of these threads running - or is it best practice and a possibility I pass my struct as a reference? Or otherwise, once I have the function I want to execute every certain amount of time, how would I effectively measure the required 'space' needed and set it? It looks like there are instructions to set it on this thread (https://os.mbed.com/questions/78708/Change-thread-stack-size/), but what about determining how much I would need?
I'm calling it 'space' because I'm quite a novice programmer, and don't know quite what type of space I need to save (RAM maybe? Or is there some other type of space I can save?).