Re: [go-nuts] Re: When appending to arrays, gmp.Int values change for large number arrays

2017-05-14 Thread Ian Lance Taylor
On Sun, May 14, 2017 at 8:12 PM, andrey mirtchovski wrote: > >> the pointer with the finalizer set on it is no longer referenced and the >> finalizer is eligible to be run when the next GC occurs. > > should this constitute an error that requires a panic, or is this not > panic-ing due to unsafe/

Re: [go-nuts] Re: When appending to arrays, gmp.Int values change for large number arrays

2017-05-14 Thread andrey mirtchovski
+ all > the pointer with the finalizer set on it is no longer referenced and the > finalizer is eligible to be run when the next GC occurs. should this constitute an error that requires a panic, or is this not panic-ing due to unsafe/cgo being in use? -- You received this message because you a

Re: [go-nuts] Re: When appending to arrays, gmp.Int values change for large number arrays

2017-05-14 Thread dantesepicsneeze
Thank you so much, that solved our problem! :D On Sunday, May 14, 2017 at 4:06:12 PM UTC-4, Kale B wrote: > > There's a finalizer being set on `*gmp.Int` when `SetString()` is called. > Since `newnum` is a `gmp.Int` and not a `*gmp.Int` and `newnum` is copied > into `output_array`, the pointer

Re: [go-nuts] Re: When appending to arrays, gmp.Int values change for large number arrays

2017-05-14 Thread Kale Blankenship
There's a finalizer being set on `*gmp.Int` when `SetString()` is called. Since `newnum` is a `gmp.Int` and not a `*gmp.Int` and `newnum` is copied into `output_array`, the pointer with the finalizer set on it is no longer referenced and the finalizer is eligible to be run when the next GC occurs.

[go-nuts] Re: When appending to arrays, gmp.Int values change for large number arrays

2017-05-14 Thread dantesepicsneeze
Here is a test case below. In short, it's appending the same number to an array, but after 2500 loops or so the value changes. package main import ( "fmt" "github.com/ncw/gmp" // "math/big" ) func test_gmp_array() { index := 0 output_array := []gmp.Int{} for index < 5000

[go-nuts] Re: When appending to arrays, gmp.Int values change for large number arrays

2017-05-14 Thread Damian Gryski
On Sunday, May 14, 2017 at 4:01:26 AM UTC+2, Elise Xue wrote: > > We're using gmp (library found at https://github.com/ncw/gmp) to run on > large inputs, and we have arrays with thousands of elements at a time in > our code. When we write these arrays to files, we find that the values of > som