[go-nuts] Re: super large virtual memory allocation for simplest golang apps, why?

2021-01-13 Thread Amnon
Have you tried https://tinygo.org/ ? On Thursday, 14 January 2021 at 06:02:35 UTC laos...@gmail.com wrote: > a helloworld net/http will ask for 1GB VSS, I understand VSS is not the > same as RSS, also did my googling and know golang malloc.go allocates 512GB > heap for 64bit system and such. >

[go-nuts] super large virtual memory allocation for simplest golang apps, why?

2021-01-13 Thread laos...@gmail.com
a helloworld net/http will ask for 1GB VSS, I understand VSS is not the same as RSS, also did my googling and know golang malloc.go allocates 512GB heap for 64bit system and such. other GC(garbage collection) languages do not preallocate huge size of VSS and they worked well. large size VSS

Re: [go-nuts] Re: Advice, please

2021-01-13 Thread Kurtis Rader
On Wed, Jan 13, 2021 at 8:31 PM Robert Engels wrote: > I forgot. But it’s to important to mention that different synchronization > methods perform differently under contention so what works well for 2 might > be really poor with 64. > Yes, but the ratio of reads to writes is usually more

Re: [go-nuts] Re: Advice, please

2021-01-13 Thread Robert Engels
I forgot. But it’s to important to mention that different synchronization methods perform differently under contention so what works well for 2 might be really poor with 64. > On Jan 13, 2021, at 10:04 PM, Kurtis Rader wrote: > >  >> On Wed, Jan 13, 2021 at 7:58 PM Robert Engels wrote: >

Re: [go-nuts] Re: Advice, please

2021-01-13 Thread Kurtis Rader
On Wed, Jan 13, 2021 at 7:58 PM Robert Engels wrote: > Why limit yourself to two? Use N routines and have each process every N in > the list. > You missed this statement in the original message of this thread: So the sketch of the go implementation is that I would have three threads - main,

Re: [go-nuts] Re: Advice, please

2021-01-13 Thread Robert Engels
Why limit yourself to two? Use N routines and have each process every N in the list. > On Jan 13, 2021, at 7:25 PM, Nikolay Dubina > wrote: > >  > Any primitive in `sync` package will do. I would go for two `RWMutex` each > for each goroutine, or two unbuffered channels for each gorouitne.

[go-nuts] Re: Advice, please

2021-01-13 Thread Nikolay Dubina
Any primitive in `sync` package will do. I would go for two `RWMutex` each for each goroutine, or two unbuffered channels for each gorouitne. However, AFAIK, in Go you can't force start execution of a goroutine. Go will try to wake up any unblocked goroutine as soon as possible though. On

Re: [go-nuts] Advice, please

2021-01-13 Thread Robert Engels
This https://github.com/robaho/go-concurrency-test might help. It has some relative performance metrics of some sync primitives. In general though Go uses “fibers” which don’t match up well with busy loops - and the scheduling overhead can be minimal. > On Jan 13, 2021, at 6:57 PM, Peter

[go-nuts] Advice, please

2021-01-13 Thread Peter Wilson
Folks I have code in C which implements a form of discrete event simulator, but optimised for a clocked system in which most objects accept input on the positive edge of a simulated clock, do their appropriate internal computations, and store the result internally. On the negative edge of the

Re: [go-nuts] how linker decide addr of sym in a circle call?

2021-01-13 Thread Ian Lance Taylor
On Wed, Jan 13, 2021 at 7:39 AM xie cui wrote: > > in linker, > the code is like this: > > func f() { >g() > } > > func g() { > f() > } > when gen binary code of func f, need func g, and gen g need f, > how linker deal with this situation, and where is the code? > is dynrelocsym do this

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread Ian Lance Taylor
On Wed, Jan 13, 2021 at 6:38 AM Kevin Chadwick wrote: > > On 1/13/21 2:09 PM, Axel Wagner wrote: > > Let me repeat my question: Do you have any concrete reason to assume there > > is a > > negative security impact of generics? Feel free to bring that up. > > Otherwise, I > > don't see a reason

Re: [go-nuts] Go Create

2021-01-13 Thread Randall O'Reilly
There's also this: https://github.com/golang/go/issues/37755 -- just retain GOPATH mode Although, now that I've been using modules more, and my various interdependent packages are more stable, I am more sympathetic to something like #26640 instead of retaining GOPATH. Anyway, having SOME

Re: [go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-13 Thread Ian Lance Taylor
On Wed, Jan 13, 2021 at 12:39 PM Marcus Manning wrote: > > Does reflection support generic instantiation? No. In the current proposal, generic functions and types are not visible at run time. Only instantiated functions and types are visible. So there is no way to even name a generic

Re: [go-nuts] an open source project to replace SMTP/email

2021-01-13 Thread Liam Breck
Here's the backstory to mnm, in a draft article not yet published. I'd love any feedback... https://mnmnotmail.org/volunteered.html On Tue, Jan 5, 2021 at 1:31 PM Liam wrote: > > The mnm project is building a legitimate email replacement: a client[1], a > server[2], and a simple protocol[3]

[go-nuts] Workaround for No parameterized methods in go generics draft

2021-01-13 Thread Marcus Manning
Regarding the the section of No parameterized methods in go generics draft: package p1 // S is a type with a parameterized method Identity. type S struct{} // Identity is a simple identity method that works for any type. func (S) Identity[T any](v T) T { return v } package p2 // HasIdentity is

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread 'Axel Wagner' via golang-nuts
On Wed, Jan 13, 2021 at 3:38 PM Kevin Chadwick wrote: > I don't and I don't mean to make demands of other peoples time. Though I'm > sure > security has been carefully considered and might be fresh in peoples minds. I don't think it has, because I don't think it needs to be. There is no reason

[go-nuts] [security] Go 1.15.7 and Go 1.14.14 pre-announcement

2021-01-13 Thread Roland Shoemaker
Hello gophers, We plan to issue Go 1.15.7 and Go 1.14.14 on Tuesday, January 19th. These are minor releases that include security fixes. Following our policy at https://golang.org/security, this is the pre-announcement of those releases. Cheers, Roland on behalf of the Go team -- You

[go-nuts] how linker decide addr of sym in a circle call?

2021-01-13 Thread xie cui
in linker, the code is like this: func f() { g() } func g() { f() } when gen binary code of func f, need func g, and gen g need f, how linker deal with this situation, and where is the code? is dynrelocsym do this job? it seem that it can deal with circles calls? -- You received this

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread Robert Engels
I covered the DoS. There are multitude of ways to create DoS even in “correct” code, panics are just one example. Memory corruption is a different class of security bug because it allows arbitrary code execution. > On Jan 13, 2021, at 8:20 AM, Kevin Chadwick wrote: > > On 1/13/21 2:06 PM,

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread Kevin Chadwick
On 1/13/21 2:09 PM, Axel Wagner wrote: > Let me repeat my question: Do you have any concrete reason to assume there is > a > negative security impact of generics? Feel free to bring that up. Otherwise, I > don't see a reason to talk about it in the design doc. I don't and I don't mean to make

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread Kevin Chadwick
On 1/13/21 2:06 PM, Robert Engels wrote: > A panic is not a security issue. Memory corruption/stack overflow is. In Go > the latter is accomplished through CGo and unsafe pointers/operations. > It isn't as clear cut as that. Panics can be security issues and memory corruption/stack overflows

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread 'Axel Wagner' via golang-nuts
On Wed, Jan 13, 2021 at 2:59 PM Kevin Chadwick wrote: > Clearly Go without interfaces, especially an empty interface is safer. > Perhaps > Generics reduce that risk via constraints etc.? > I understand why you might argue interfaces make the language less safe. But generics are a mechanism with

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread Robert Engels
A panic is not a security issue. Memory corruption/stack overflow is. In Go the latter is accomplished through CGo and unsafe pointers/operations. Continuous panics can be considered a security issue as a DoS attack but IMO at least there are many ways to generate continuous errors that are

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread Kevin Chadwick
On 1/13/21 11:17 AM, Axel Wagner wrote: > Assuming generics like interfaces, potentially erode type safety. > > > Can you elaborate? Because that statement seems exactly contrary to > established > wisdom. Clearly Go without interfaces, especially an empty interface is safer. Perhaps

Re: [go-nuts] Go Create

2021-01-13 Thread Wojciech S. Czarnecki
Dnia 2021-01-13, o godz. 07:22:52 Rob Pike napisał(a): >Also, one must be sure to remove the replace directive before > releasing the code, which is an easy detail to forget. I'd humbly summon https://github.com/golang/go/issues/26640 here. Opened at the modules advent, still it sees no love

Re: [go-nuts] Run a goroutine until a channel receives a message

2021-01-13 Thread Sankar P
> > if `ws.Read` returns after a reasonable timeout, you can perform a > non-blocking receive on the quit channel to see if it has been > closed/something has been sent to it: > > select { > case <-quit: > break > default: >

Re: [go-nuts] Generics security discussion.

2021-01-13 Thread 'Axel Wagner' via golang-nuts
On Wed, Jan 13, 2021 at 11:54 AM Kevin Chadwick wrote: > I appreciate that generics use will be optional. However I am concerned > that neither in the design draft nor the proposal issue, that the word > security nor safety has been used even once. "Safety" has been mentioned lots of times, in

Re: [go-nuts] Run a goroutine until a channel receives a message

2021-01-13 Thread Gregor Best
Hi, if `ws.Read` returns after a reasonable timeout, you can perform a non-blocking receive on the quit channel to see if it has been closed/something has been sent to it: select { case <-quit: break default:

[go-nuts] Run a goroutine until a channel receives a message

2021-01-13 Thread Sankar
I have a function that must be executed as a go routine infinitely until a message comes in a channel. For example: func readWebSocket(ws *websocket.socket, quit chan bool) { for { out, err = ws.Read() log.Println(out, err) } } Now I call this above function as a goroutine from

[go-nuts] Generics security discussion.

2021-01-13 Thread Kevin Chadwick
I appreciate that generics use will be optional. However I am concerned that neither in the design draft nor the proposal issue, that the word security nor safety has been used even once. Assuming generics like interfaces, potentially erode type safety. Will generics increase the likelihood