Better to use an avr dragon to debug things. Give me an example that is short as possible and i'll look at it w/mine.
--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.
Better to use an avr dragon to debug things. Give me an example that is short as possible and i'll look at it w/mine.
Hi TK,
I've looked over your code and output, but I can't find anything wrong
with it. I suspect that the problem is in your expectations, not the
actual behaviour. I'll expand on that below.
> cap=1 len=1 addrS=0x8DF addrBuf=0x1EF
> cap=1 len=1 addrS=0x133 addrBuf=0x1E7 a
> cap=1 len=1 addrS=0x12C addrBuf=0x1EB b
> mem @ loop end: 1759
>
> cap=1 len=1 addrS=0x8DF addrBuf=0x1EF << Question 1: 0x1E7 is free now. Why not created there?
> cap=2 len=2 addrS=0x133 addrBuf=0x1F3 aa
> cap=2 len=2 addrS=0x12C addrBuf=0x1F8 bb
> mem @ loop end: 1757
0x1E7 is used for m_sText1 at that point. Only when m_sText1 += "a"
runs, will m_sText1 be reallocated. In your code, you print the first
line before appending the "a", so at that point, 0x1E7 is still used.
Hi TK,
> cap=1 len=1 addrS=0x12C addrBuf=0x1EB b << same here with sText2. I
> already wonder here why the buffer isn't realloc. Obviously there is space
> for at least 1 char.
I'm not sure why that is, but perhaps it is a side-effect of the
block-based allocation changes you applied to the String class (at least
I believe you mentioned that, right?).
> cap=1 len=1 addrS=0x8DF addrBuf=0x1EF << 0x1E7 is free now. Why isn't
> sText put there? Does the compiler optimize things and keep sText although
> defined locally? It should be removed from stack and heap when loop() is
> exited.
Ah, you're right. 0x1E7 is indeed free and malloc *could* have used it for
allocating sText, I believe.
> But why is the content completely lost if the length exceeds 260 chars?
Oh, seems I missed that part. That is indeed weird. I wonder if this is
somehow a bug in the serial printing code or something like that? Does
it also happen when you just allocate a long String statically and print
that?
--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.