Use JNI to call Java in C on MacOS Jun 13, 2019 For someone who wants to use Java code in C by JNI, you can call by jni with Java class or JAR(Java ARchive). Here is an example of how to... [read more]
https://secview.io May 31, 2019 友站推薦! For developers who are interested in security especially as a defender, my friend is currently working on this site to give some posts in Taiwanese. The writer is graduated... [read more]
Golang about go_tls.h and go_asm.h Apr 18, 2019 According to official documentation, get_tls is a marco defined in go_asm.h. But it is actually in go_tls.h which is in the go source. #include "go_asm.h" // this should be #include... [read more]
Go morestack_noctxt Apr 1, 2019 What’s the default stack size of a goroutine? For the default stack size of a goroutine. Basically it’s 2Kb pre routine. But soon we can discover in the source code,... [read more]
je_malloc Mar 26, 2019 I was planning to write some notes about ptmalloc, tcmalloc and jemalloc. Well, it is impossible for sure. So I decide to read jemalloc first, because this is the first... [read more]
Redis is not only single threaded Mar 21, 2019 常聽到或是看到人說 Redis 是 single threaded,但始終沒有看到有人貼出程式碼證明這件事情。 事實上這是錯的,我們到 Github 直接搜尋 pthread_create,就可以發現其實在 redis/src/bio.c 裡面是有開 thread 來做 Background I/O 的,而且 redis 使用的 malloc lib 也就是 jemalloc,裡面也是會開 multithread 的。 請見原始碼 /* bio.c#L118-L128 */ /* Ready... [read more]
Delve - A debugger for the Go programming language Mar 19, 2019 Go 是一個靜態語言,想要了解我們寫出來的程式碼到底深入做了哪些事情,從組合語言來看是個很直接的方法。官方有教我們使用 GDB 來解析,但是因為 GDB 並不了解 Go 本身的一些內建 lib 結構,和 Go 運作的模型,所以使用 Delve 這個特製給 Go 的工作是最適合的。 建議直接閱讀官方文件及安裝文件,這邊只帶過一些我覺得好用的指令。 // hello.go package main import "fmt" func main() { fmt.Printf("hello, 世界\n") } $... [read more]