[En-Nut-Discussion] How much memory is still available in the stack of a thread?

Rodrigue rodrigue.roland at gmail.com
Thu May 17 18:21:40 CEST 2007


Thank you


Ovidiu-2 wrote:
> 
> On 4/25/07, Rodrigue <rodrigue.roland at gmail.com> wrote:
>>
>>
>> It was just to propose a way to optimize the stack space consumed by a
>> thread...
>> Thank you for the link, some informations were very instructive!
> 
> 
> 
> Please, could you tell me what represents the variable var in the
> following
>> operation:
>> u_int var =  (uptr_t) runningThread->td_sp - (uptr_t)
> 
> 
> http://www.ethernut.de/en/documents/ntn-2_events.html might help (look for
> "td_sp" in the first picture!)
> 
> Harald Kipp wrote:
>> >
>> > Each thread has its own stack space, taken from the global heap.
>> > http://www.vs.inf.ethz.ch/edu/wsn/tut/ch4-5.pdf
>> >
>> > Why do you need to know the available stack space of a single thread?
>> > Just asking, because I assume that things are more complex than you are
>> > possibly aware off.
>> >
>> > Harald
>> >
>> > Rodrigue schrieb:
>> >> I'm not sure but may be by using the variable runningThread:
>> >>    u_int avaiblememory =  (uptr_t) runningThread->td_sp - (uptr_t)
>> >> runningThread->td_memory;
>> >>
>> >> with uptr_t td_sp;               /*!< \brief Stack pointer. */
>> >>      u_char *td_memory;          /*!< \brief Pointer to heap memory
>> used
>> >> for
>> >> stack. */
>> >>
>> >> Does each thread has is own heap memory? I tought that it was global
>> and
>> >> located at the end of the external memory growing downwards...
>> >>
>> >>
>> >
>> > _______________________________________________
>> > http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-much-memory-is-still-available-in-the-stack-of-a-thread--tf3639143.html#a10178771
>> Sent from the MicroControllers - Ethernut mailing list archive at
>> Nabble.com.
>>
>> _______________________________________________
>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
> 
> 

-- 
View this message in context: http://www.nabble.com/How-much-memory-is-still-available-in-the-stack-of-a-thread--tf3639143.html#a10667078
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.




More information about the En-Nut-Discussion mailing list