Channel Element type too large Golang

Viewed 1455

I'm writing a program that works with matrixes in parallel.

My matrixes are created using a constant n.

const n = 10

The channels are created with the following code:

a := make(chan [n][n]int)

This works fine for anything under a value of around 12 for n however anything greater and the following error is given:

channel element type too large (>64kB)

Looking at tutorials etc, and it seem buffered channels may be the way to solve this but I tried doing this with the following code and the same error was given:

a := make(chan [n][n]int, 1000)

Am I using buffered channels correctly or are they not the way to solve this issue? Any tips on how I can move forward with this greatly appreciated.

EDIT: Following on from the answer given and comments I'm now trying to create a global matrix which is blank and go routines can write to.

const n int = 1024

blank [n][n]int

I'm unsure how it could be declared globally and have attempted the above to solve this. Does it need initialising globally? Everything I seem to try gives errors.

1 Answers
Related