This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: wescale-config | |
namespace: default | |
data: | |
vttablet.cnf: |- | |
[vttablet] | |
health_check_interval=1s | |
shard_sync_retry_delay=1s |
考虑这个问题: 在Golang的函数中创建一个struct,然后将它return,这个struct的内存空间会被分配在哪里?return的时候会有哪些操作?是否会发生拷贝?
有关go内存是在堆上分配的,还是在栈上分配的,这个是在编译过程中,通过逃逸分析来确定的,其主体思想是: 假设有变量v,及指向v的指针p,如果p的生命周期大于v的生命周期,则v的内存要在堆上分配。 https://cloud.tencent.com/developer/article/1861199
小技巧:我们也可以在编译时,通过加上-m参数,来让编译器告诉我们,一个变量到底是分配在堆上,还是在栈上
Template:
- [x] task1
- [ ] task2
- [x] task3
- [ ] task4
Effect:
- task1
- task2