fogleman / primitive

Reproducing images with geometric primitives.
https://primitive.lol/
MIT License
12.35k stars 608 forks source link

failed MSpanList_Insert #13

Closed thejmazz closed 7 years ago

thejmazz commented 7 years ago

Used it like so:

primitive -i mushroom.jpg -o mushroom-primitive.jpg -n 100 -r=256

With this pic:

![mushroom](https://cloud.githubusercontent.com/assets/1270998/18768354/8ddb334e-80f2-11e6-8bc2-2976f49cf947.jpg)

Error log:

``` failed MSpanList_Insert 0x35dd90 0x4b897ae7b8e 0x0 fatal error: MSpanList_Insert runtime stack: runtime.MSpanList_Insert(0x30aa68, 0x35dd90) /usr/local/go/src/runtime/mheap.c:692 +0x8f runtime.MHeap_Alloc(0x307660, 0x1, 0x1000000002b, 0xe209) /usr/local/go/src/runtime/mheap.c:240 +0x66 runtime.MCentral_CacheSpan(0x310ff8, 0x35dcc0) /usr/local/go/src/runtime/mcentral.c:85 +0x167 runtime.MCache_Refill(0x349000, 0x2b, 0x35dcc0) /usr/local/go/src/runtime/mcache.c:90 +0xa0 goroutine 1 [running]: runtime.switchtoM() /usr/local/go/src/runtime/asm_amd64.s:198 fp=0xc2088bf8b8 sp=0xc2088bf8b0 runtime.mallocgc(0x1000, 0x0, 0x3, 0x1d3f9) /usr/local/go/src/runtime/malloc.go:178 +0x849 fp=0xc2088bf968 sp=0xc2088bf8b8 runtime.rawmem(0x1000, 0x1000) /usr/local/go/src/runtime/malloc.go:371 +0x39 fp=0xc2088bf990 sp=0xc2088bf968 runtime.growslice(0x174b20, 0xc2080e4800, 0x53, 0x53, 0x1a, 0x0, 0x0, 0x0) /usr/local/go/src/runtime/slice.go:83 +0x237 fp=0xc2088bf9f0 sp=0xc2088bf990 github.com/fogleman/primitive/primitive.rasterizeTriangle(0xff, 0x21, 0xff, 0x73, 0x23, 0x8d, 0x0, 0x0, 0x0) /Users/jmazz/go/src/github.com/fogleman/primitive/primitive/triangle.go:126 +0x348 fp=0xc2088bfa98 sp=0xc2088bf9f0 github.com/fogleman/primitive/primitive.(*Triangle).Rasterize(0xc2084c5e40, 0x0, 0x0, 0x0) /Users/jmazz/go/src/github.com/fogleman/primitive/primitive/triangle.go:101 +0x74 fp=0xc2088bfae8 sp=0xc2088bfa98 github.com/fogleman/primitive/primitive.(*Model).Energy(0xc208058180, 0x35b770, 0xc2084c5e40, 0xc208032a40, 0xc2084c5e40) /Users/jmazz/go/src/github.com/fogleman/primitive/primitive/model.go:213 +0x44 fp=0xc2088bfb78 sp=0xc2088bfae8 github.com/fogleman/primitive/primitive.(*State).Energy(0xc20803ccc0, 0x1db160) /Users/jmazz/go/src/github.com/fogleman/primitive/primitive/state.go:16 +0x4c fp=0xc2088bfba8 sp=0xc2088bfb78 github.com/fogleman/primitive/primitive.HillClimb(0x35b7b8, 0xc20803ccc0, 0x64, 0x0, 0x0) /Users/jmazz/go/src/github.com/fogleman/primitive/primitive/anneal.go:63 +0xec fp=0xc2088bfc00 sp=0xc2088bfba8 github.com/fogleman/primitive/primitive.(*Model).BestHillClimbState(0xc208058180, 0xc208032a40, 0x1, 0x64, 0x64, 0xa, 0x3a7e5) /Users/jmazz/go/src/github.com/fogleman/primitive/primitive/model.go:135 +0xf4 fp=0xc2088bfd00 sp=0xc2088bfc00 github.com/fogleman/primitive/primitive.(*Model).Step(0xc208058180) /Users/jmazz/go/src/github.com/fogleman/primitive/primitive/model.go:122 +0x55 fp=0xc2088bfd58 sp=0xc2088bfd00 main.main() /Users/jmazz/go/src/github.com/fogleman/primitive/main.go:109 +0x69a fp=0xc2088bff98 sp=0xc2088bfd58 runtime.main() /usr/local/go/src/runtime/proc.go:63 +0xf3 fp=0xc2088bffe0 sp=0xc2088bff98 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1 fp=0xc2088bffe8 sp=0xc2088bffe0 ```
fogleman commented 7 years ago

That's very strange. Did you run out of memory or something? What go version?

thejmazz commented 7 years ago
go version go1.4.2 darwin/amd64

memory and cpu seem to be stable

fogleman commented 7 years ago

That's an old Go, I'd try a new one...

thejmazz commented 7 years ago

ah yes, with

go version go1.7.1 darwin/amd64

and then ran go get again, it works :)

My result with 1000 circles :D

mushroom-primitive

Cheers.