Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-16 Thread Shulhan
> On 16 Nov 2020, at 16.24, Afriyie Abraham Kwabena > wrote: > > Hi , > > You are right but am new to programming and currently this what i have done. > I have an http server handler that receives the PATCH request and stores the > id and the current time stamp of the request. > But my prob

Re: [go-nuts] Let Go also support manual memory management, a good or bad idea?

2020-11-16 Thread Henry
There is a very little performance benefit to manual memory management with today's hardware. Someone mentioned games earlier. Many games are written in languages with GC. C# and Java are among the most popular languages for game development. A number of games are written in C++ but many develop

Re: [go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-16 Thread Robert Engels
Yes, Go’s lack of a generational collector can make moving certain large read only structures off heap make sense but a careful design of these structures (no pointers) often removes this need. > On Nov 16, 2020, at 11:12 AM, Jesper Louis Andersen > wrote: > >  >> On Mon, Nov 16, 2020 at 4:

Re: [go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-16 Thread Jesper Louis Andersen
On Mon, Nov 16, 2020 at 4:04 PM tapi...@gmail.com wrote: > > I feel there still room between the two to explore, though I have not a > clear thought on this yet. > Many of the tricks tend to coincide with both allocator strategies as you work more on them. The methods are much more two sides of

Re: [go-nuts] How to clear current line in terminal

2020-11-16 Thread Stephen Illingworth
This is how I would do it. Note that you must be careful not to insert newlines. If you do, terminal control becomes trickier. package main import "fmt" // ClearLine is the CSI sequence to clear the entire of the current line. const ClearLine = "\033[2K" func main() { // print a string

Re: [go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-16 Thread tapi...@gmail.com
On Monday, November 16, 2020 at 9:17:50 AM UTC-5 ren...@ix.netcom.com wrote: > Then you have reference counting or tracing GC. > > Tracing GC a which Go has - has been proven superior to reference > counting. > I feel there still room between the two to explore, though I have not a clear th

Re: [go-nuts] Let Go also support manual memory management, a good or bad idea?

2020-11-16 Thread Ian Lance Taylor
On Mon, Nov 16, 2020 at 5:49 AM tapi...@gmail.com wrote: > > @Ian > How about forbidding manual allocated memory references normal pointers? I suppose I don't understand how to do that without being either memory unsafe or being unexpectedly slow. (If it's OK to be memory unsafe, then I don't th

Re: [go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-16 Thread Robert Engels
Then you have reference counting or tracing GC. Tracing GC a which Go has - has been proven superior to reference counting. > On Nov 16, 2020, at 8:02 AM, tapi...@gmail.com wrote: > >  > >> On Sunday, November 15, 2020 at 10:24:05 PM UTC-5 ren...@ix.netcom.com wrote: >> It is the same. If i

Re: [go-nuts] Is it possible that a hybrid memory management could be implemented?

2020-11-16 Thread tapi...@gmail.com
On Sunday, November 15, 2020 at 10:24:05 PM UTC-5 ren...@ix.netcom.com wrote: > It is the same. If it can escape the allocation frame you need GC. > It could be viewed as advanced escape analyzing (by supporting run-time escape analyzing). For example, a value might be used by many goroutine

Re: [go-nuts] Re: Is it possible that a hybrid memory management could be implemented?

2020-11-16 Thread tapi...@gmail.com
On Monday, November 16, 2020 at 5:19:59 AM UTC-5 Jan Mercl wrote: > On Mon, Nov 16, 2020 at 11:14 AM 陶青云 wrote: > > > FYI > > https://dgraph.io/blog/post/manual-memory-management-golang-jemalloc/ > > A CGo-free manual memory allocator might be a better fit sometimes: > https://godoc.org/mod

Re: [go-nuts] Let Go also support manual memory management, a good or bad idea?

2020-11-16 Thread tapi...@gmail.com
@kortschak I think there are many benefits by using a pure Go implementation than a CGO one. It would be even better to reuse/expose the internal tcmalloc. @Ian How about forbidding manual allocated memory references normal pointers? On Sunday, November 15, 2020 at 9:23:54 PM UTC-5 Ian Lance Tay

Re: [go-nuts] Re: Is it possible that a hybrid memory management could be implemented?

2020-11-16 Thread Jan Mercl
On Mon, Nov 16, 2020 at 11:14 AM 陶青云 wrote: > FYI > https://dgraph.io/blog/post/manual-memory-management-golang-jemalloc/ A CGo-free manual memory allocator might be a better fit sometimes: https://godoc.org/modernc.org/memory -- You received this message because you are subscribed to the Goog

[go-nuts] Re: Is it possible that a hybrid memory management could be implemented?

2020-11-16 Thread 陶青云
FYI https://dgraph.io/blog/post/manual-memory-management-golang-jemalloc/ 在2020年11月16日星期一 UTC+8 上午9:19:59 写道: > > For example, some local memory allocations could be detected no used > elsewhere so that they can may be freed immediately when out of reach > instead of waiting to be freed

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-16 Thread Afriyie Abraham Kwabena
Hi , You are right but am new to programming and currently this what i have done. I have an http server handler that receives the PATCH request and stores the id and the current time stamp of the request. But my problem is how to write the worker function to do the clean up every X seconds. Cod