[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-05 Thread Dave Cheney
Your operating system may not be reporting memory correctly. To get the accurate report of the memory that your go process uses http://talks.godoc.org/github.com/davecheney/presentations/seven.slide#23 Install the pprof handler, and scroll to the bottom of go tool pprof http://localhost:3999/

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-05 Thread aiden0xz
Build with -race flag report nothing. Something is interesting is that in the dev env the gc will release the memory, but in product env the memory seems is not release to OS. 在 2016年9月6日星期二 UTC+8下午2:05:38,Dave Cheney写道: > > runtime.goexit is the bottom most stack frame of any running gorout

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-05 Thread 'Isaac Gouy' via golang-nuts
On Wednesday, August 31, 2016 at 6:31:05 AM UTC-7, Peter Herth wrote: > > And, as this very benchmarking site is far too often abused to talk down > on languages, just because they have some bad test results, we as the Go > community should try to get the fastest results there - most other progra

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-05 Thread Dave Cheney
runtime.goexit is the bottom most stack frame of any running goroutine. When the caller of runtime.goexit returns, this function will clean up the goroutine. If you are not leaking goroutines, then your application must be keeping too much memory live, possibly in a shared map. It's probably

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-05 Thread aiden0xz
The number of goroutines is normal., but the memory continue increase. I did not understand why the runtime.goexit took so many memory. 在 2016年9月6日星期二 UTC+8上午11:07:42,Dave Cheney写道: > > It looks like your application is using 4.5gb of ram. Check the number of > sockets and goroutines you have r

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-05 Thread 'Isaac Gouy' via golang-nuts
On Wednesday, August 31, 2016 at 3:53:12 PM UTC-7, Harald Weidner wrote: > > > The regex-dna benchmark is even more strange. Neither the measured Go nor > the > Java implementation use the standard regexp libs. The Go program imports > bindings to PCRE, the Java program uses TclRE. > There'

Re: [go-nuts] Go performance in regexdna

2016-09-05 Thread 'Isaac Gouy' via golang-nuts
On Thursday, September 1, 2016 at 2:45:42 PM UTC-7, Ian Lance Taylor wrote: > > On Thu, Sep 1, 2016 at 1:34 PM, DrGo > > wrote: > > What is the reason for Go particularly poor performance in regexdna as > shown here? > > > https://benchmarksgame.alioth.debian.org/u64q/performance.php?test=re

Re: [go-nuts] compile vs stylistic errors

2016-09-05 Thread Sam Whited
On Mon, Sep 5, 2016 at 6:22 PM, Anmol Sethi wrote: > What seperates a compile and stylistic error? As in, why not make the > non-gofmt style illegal and enforce the gofmt style by the compiler? Two reasons, I think: 1. It would make the compiler more complicated 2. Because gofmt isn't perfe

Re: [go-nuts] What is the best way to handle user interrupts in a loop

2016-09-05 Thread Ian Lance Taylor
On Sat, Sep 3, 2016 at 9:40 PM, Kalpa Welivitigoda wrote: > > I am doing a file copy in a loop and I want to handle user interrupts such > as Ctrl+c. In such an interrupt I need to log the filename of the file being > copied (and delete that file from the target). Following is my code snippet > (u

[go-nuts] memory leak with websocket service based on go-socket.io

2016-09-05 Thread Dave Cheney
It looks like your application is using 4.5gb of ram. Check the number of sockets and goroutines you have running. If there are no timeouts then the goroutines could remain alive pinning a lot of memory. -- You received this message because you are subscribed to the Google Groups "golang-nuts

[go-nuts] memory leak with websocket service based on go-socket.io

2016-09-05 Thread aiden0xz
We have a simple websocket service based on go-socket.io and have a memory leak problem. We found the memory usage is always increase, the idle heap is not return back to the OS. The heap pprof show that the runtime.goexit took much memory, seems t

Re: [go-nuts] compile vs stylistic errors

2016-09-05 Thread Matt Harden
That would be pretty heavy-handed. The determination of what's style and what's not is a little arbitrary. For the most part, gofmt is all about where the whitespace goes (there are other things, I realize). The compiler mostly doesn't care about whitespace, as long as some whitespace is present wh

Re: [go-nuts] Parsing of an RSA Public Key raises an error: Help Needed

2016-09-05 Thread Matt Harden
Is the gist public? I got a 404 on that link. On Mon, Sep 5, 2016 at 4:09 PM Sadick Junior wrote: > Parsing of the public key raises an error. I have not been able to know > why. I > have looked at the jwt docs, the public key is valid. someone please help. > It seems am missing something. Any

[go-nuts] Re: Help me, i don't understand why

2016-09-05 Thread Van Hu
Hope this helps: https://play.golang.org/p/5UnIuSE50F package main import "time" func main() { // redact ch1 := make(chan struct{}) ch2 := make(chan struct{}) go func() { for _, value := range []int{1, 3, 5} { // redact println(value) // redact <-ch1 ch2<-struct{}{} } }() go func() { for _, val

Re: [go-nuts] Help me, i don't understand why

2016-09-05 Thread Matt Harden
Think about how you want your two goroutines to coordinate. Imagine you have two balls that you can throw back & forth between two people. These are like values passing through channels. How could you use the balls to help two people coordinate so that they say the numbers in order? Then translate

[go-nuts] compile vs stylistic errors

2016-09-05 Thread Anmol Sethi
What seperates a compile and stylistic error? As in, why not make the non-gofmt style illegal and enforce the gofmt style by the compiler? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails f

[go-nuts] Re: [golang-dev] help me with gorutines

2016-09-05 Thread Dave Cheney
Please redirect this question to golang-nuts. On Sun, Sep 4, 2016 at 7:22 AM, Ринат Галиев wrote: > Hi, i need to solve the task: > Change the program so that the numbers 1 through 6 were printed to the > console in order. Allowed to amend the sections of code that are marked > commentary «// red

[go-nuts] Parsing of an RSA Public Key raises an error: Help Needed

2016-09-05 Thread Sadick Junior
Parsing of the public key raises an error. I have not been able to know why. I have looked at the jwt docs, the public key is valid. someone please help. It seems am missing something. Any help will be highly appreciated. Here is a link to my github gist

[go-nuts] Re: gorutine, channels

2016-09-05 Thread Ринат Галиев
I'm sorry, I do not know how it happened Allowed to amend the sections of code that are marked commentary «// redact». this is original code: https://play.golang.org/p/tUMlHWHfJE пятница, 2 сентября 2016 г., 20:07:32 UTC+3 пользователь Ринат Галиев написал: > > Я не могу заставить работать п

[go-nuts] Re: gorutine, channels

2016-09-05 Thread Ринат Галиев
Allowed to amend the sections of code that are marked commentary «// redact». -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroup

[go-nuts] What is the best way to handle user interrupts in a loop

2016-09-05 Thread Kalpa Welivitigoda
Hi, I am doing a file copy in a loop and I want to handle user interrupts such as Ctrl+c. In such an interrupt I need to log the filename of the file being copied (and delete that file from the target). Following is my code snippet (user interrupt handling is not yet implemented), for _, pFile :=

[go-nuts] Re: gorutine, channels

2016-09-05 Thread Ринат Галиев
I'm sorry, I do not know why the code is translated))) This is original: https://play.golang.org/p/vWkfa2l0lC -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to gola

[go-nuts] Help me, i don't understand why

2016-09-05 Thread Ринат Галиев
Hi, i need to solve the task: Change the program so that the numbers 1 through 6 were printed to the console in order. Allowed to amend the sections of code that are marked commentary «// redact». https://play.golang.org/p/tUMlHWHfJE it is not work: https://play.golang.org/p/hW-9J5YfC4 i know,

[go-nuts] Re: Speeding up Go Report Card

2016-09-05 Thread Thomas de Zeeuw
Hi Shawn, I don't think Go Report Card is particularly slow, but I have two ideas: 1. Try running the different checks within the process, using the Go API. This should reduce the overhead of creating x processes per report card. But I don't know if every check has an easy to use Go API. 2. Tr

[go-nuts] Re: gorutine, channels

2016-09-05 Thread Ринат Галиев
I'm sorry, I do not know how it happened this is original code: https://play.golang.org/p/tUMlHWHfJE Allowed to amend the sections of code that are marked commentary «// redact» пятница, 2 сентября 2016 г., 21:25:44 UTC+3 пользователь dja...@gmail.com написал: > > working examle: > https://play.

[go-nuts] A lightweight repository data collection like heka and logstash.https://github.com/wgliang/logcool

2016-09-05 Thread fiisio
A lightweight repository data collection like heka and logstash.https://github.com/wgliang/logcool -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+u

[go-nuts] Re: The state of Go and WebRTC (especially RTCDataChannel)

2016-09-05 Thread globalikslivov
And on pure C how to use your librtcdc? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://

[go-nuts] Re: Reflection: Set the Pointer to Zero Value of Direct Type

2016-09-05 Thread Roberto Zanotto
Glad I could help. I also enjoy using package reflect very much, it makes up for the lack of generics very well in certain situations. By the way, to copy things into a pointer with reflection you normally do p.Elem().Set(anotherValue). In this case it wasn't necessary, since New already returns

[go-nuts] Re: Reflection: Set the Pointer to Zero Value of Direct Type

2016-09-05 Thread dc0d
You're awesome! And Go's reflection is much better than what I've expected - and yes, I like it, I use it! On Tuesday, September 6, 2016 at 12:57:45 AM UTC+4:30, Roberto Zanotto wrote: > > If you want a pointer instead of the direct value, just use New instead of > Zero: > v = reflect.New(fd.T

[go-nuts] Re: Reflection: Set the Pointer to Zero Value of Direct Type

2016-09-05 Thread Roberto Zanotto
If you want a pointer instead of the direct value, just use New instead of Zero: v = reflect.New(fd.Type().Elem()).Interface() On Monday, September 5, 2016 at 9:30:13 PM UTC+2, dc0d wrote: > > Exactly! Thanks! Now, how to put it inside the pointer? I mean, how to get > it's address and put that

[go-nuts] Re: Reflection: Set the Pointer to Zero Value of Direct Type

2016-09-05 Thread dc0d
Exactly! Thanks! Now, how to put it inside the pointer? I mean, how to get it's address and put that address inside the pointer variable? On Monday, September 5, 2016 at 10:47:23 PM UTC+4:30, Roberto Zanotto wrote: > > I should learn to read the questions more carefully before answering -_- > In

[go-nuts] Re: Reflection: Set the Pointer to Zero Value of Direct Type

2016-09-05 Thread Roberto Zanotto
I should learn to read the questions more carefully before answering -_- In the code you commented out, fd.Type() is a pointer type, so the zero value of a pointer type is a nil pointer. If you do fd.Type().Elem() it gives you the "dereferenced" type of the value. So, maybe you want: v = reflect.

[go-nuts] Re: Reflection: Set the Pointer to Zero Value of Direct Type

2016-09-05 Thread Roberto Zanotto
I meant v = ... On Monday, September 5, 2016 at 8:11:00 PM UTC+2, Roberto Zanotto wrote: > > I suppose you want to allocate a new value, since fd is nil: > fd = reflect.New(reflect.TypeOf(fd).Elem()) > > On Monday, September 5, 2016 at 7:28:13 PM UTC+2, dc0d wrote: >> >> How can I fill a pointer t

[go-nuts] Re: Reflection: Set the Pointer to Zero Value of Direct Type

2016-09-05 Thread Roberto Zanotto
I suppose you want to allocate a new value, since fd is nil: fd = reflect.New(reflect.TypeOf(fd).Elem()) On Monday, September 5, 2016 at 7:28:13 PM UTC+2, dc0d wrote: > > How can I fill a pointer to point to the zero value of underlying type? > > Like in: > > if fd.Kind() == reflect.Ptr { > if fd

[go-nuts] Reflection: Set the Pointer to Zero Value of Direct Type

2016-09-05 Thread dc0d
How can I fill a pointer to point to the zero value of underlying type? Like in: if fd.Kind() == reflect.Ptr { if fd.IsNil() { // how to set v (pointer) to point to a zero value of underlying type? // using this: // v = reflect.Zero(fd.Type()).Interface() // still gives a nil value. } else

Re: [go-nuts] Re: Introducing Planet Golang

2016-09-05 Thread Mateusz Czapliński
On Sunday, September 4, 2016 at 2:44:53 PM UTC+2, Nicolas Martyanoff wrote: > Speaking about Google, does someone know who to contact to get permission > to > add the feed of the official Go blog (blog.golang.org) ? > I suppose it'd be best to ask Andrew Gerrand. -- You received this messag

[go-nuts] Re: job queue with the ability to kill worker processes

2016-09-05 Thread Jason E. Aten
On Thursday, September 1, 2016 at 4:40:50 AM UTC-7, Tieson Molly wrote: > > Are there any go projects that implement a queue where workers that > consume the queue could be tracked and potentially killed if the end user > decides to cancel the job? > I assume you mean across multiple worker proc

[go-nuts] Re: Speeding up Go Report Card

2016-09-05 Thread James Aguilar
On Friday, September 2, 2016 at 6:50:58 AM UTC-7, Shawn Smith wrote: > > Hi, > > I'm one of the maintainers of Go Report Card http://goreportcard.com/ and > I am looking for advice on how to make it faster. > > Basically we run a series of checks (gofmt, vet, etc.) on your Go > repository and pro

[go-nuts] Re: Can anyone show an example of using Context in net.http middleware?

2016-09-05 Thread kevin . norman . gough
Oh thank you! On Friday, September 2, 2016 at 4:40:51 PM UTC-5, fabrizi...@gmail.com wrote: > > Here is an example: > https://play.golang.org/p/3mFS_7-mM8 > > You have two wrapper handlers (logIt and authIt). authIt, authenticates > every handler you want to authenticate. For simplicity it take

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-05 Thread Jason E. Aten
On Wednesday, August 31, 2016 at 8:44:57 AM UTC-7, Eric Johnson wrote: > > > On 8/31/16 2:04 AM, Harald Weidner wrote: > > The Java counterpart of this benchmark does not use the Java build-in > > maps, but imports a map implementation for fixed data types from the > > fastutil project. > > >

Re: [go-nuts] Speeding up Go Report Card

2016-09-05 Thread Nick Craig-Wood
On 02/09/16 14:41, Shawn Smith wrote: > I'm one of the maintainers of Go Report Card http://goreportcard.com/ > and I am looking for advice on how to make it faster. > > Basically we run a series of checks (gofmt, vet, etc.) on your Go > repository and provide a grade based on how many errors each