[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Re: Still occasional memory corruption...



Em 20-11-2013 10:36, James Harkins escreveu:
> On Nov 20, 2013 6:18 PM, "James Harkins" <jamshark70@xxxxxxxxx
> <mailto:jamshark70@xxxxxxxxx>> wrote:
>> Wait... here it is... the error happens in collectAs. My call stack
> shows that the "class" argument is Array, and one item is successfully
> added into the array. By the time it gets to the second iteration,
> somehow "res" has changed from an array to a TempoClock, despite the
> fact that res IS NEVER REASSIGNED in this method! That is,
> function.value(elem, i) has had a side effect in a scope to which that
> function has NO ACCESS.
> 
> Another (likely more plausible) explanation is stack corruption. I just
> remembered that the stack trace shows res is still an array. So,
> probably when the VM gets around to sending the message "add," it gets
> the clock off the stack instead of what ought to be the receiver.
> 
> Either way, not good.
> 
> hjh
> 
I'm afraid I can't help much at all, but just so you feel less lonelly,
I was at some point getting similar behaviour from sclang. At some point
the same variable, without being changed, would output completelly
random results.

https://github.com/supercollider/supercollider/issues/999

Stating the obvious, indeed one of the advantages of using a mainstream
language is that you have people that can look into this sort of stuff
that know exactly what is going on, freeing the sc developers to focus
on the musical aspect of things. But then again, I'm afraid there will
never be consensus on a language... sclang is kind of the glue that
keeps us together, for the better or worse ;-)

> evaluating the above a couple of times :
> 
> abc: emacs
> Some(2)
> abc: a Function
> Some(2)
> abc: nil
> Some(2)
> abc: 0
> Some(2)
> abc: SystemClock
> Some(2)
> abc: true
> Some(2)
> abc: true
> Some(2)
> abc: a Function
> Some(2)
> abc: true
> Some(2)
> abc: SystemClock
> Some(2)
> abc: true
> Some(2)
> abc: AppClock
> Some(2)
> abc: 512
> Some(2)
> abc: AppClock
> Some(2)
> abc: 57110
> Some(2)
> abc: SystemClock
> Some(2)
> abc: true
> Some(2)
> abc: true
> Some(2)
> abc: false
> Some(2)

best,
Miguel

Attachment: signature.asc
Description: OpenPGP digital signature