Skip to content

Commit

Permalink
feat:新增题目
Browse files Browse the repository at this point in the history
  • Loading branch information
lifei6671 committed Jan 9, 2025
1 parent f5a30a5 commit 189d985
Show file tree
Hide file tree
Showing 6 changed files with 535 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- [字符串转成byte数组,会发生内存拷贝吗?](question/q020.md)
- [http包的内存泄漏](question/q021.md)
- [sync.Map 的用法](question/q022.md)
- [Golang基础语法相关题目](question/q023.md)

## Golang 理论

Expand Down
13 changes: 12 additions & 1 deletion question/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@
- [字符串替换问题](q005.md)
- [机器人坐标计算](q006.md)
- [语法题目](q007.md)
- [定时与painc恢复](q012.md)
- [定时与painc恢复](q012.md)
- [为 sync.WaitGroup 中Wait函数支持 WaitTimeout 功能](q013.md)
- [语法找错题](q014.md)
- [golang 并发题目测试](q015.md)
- [记一道字节跳动的算法面试题](q016.md)
- [多协程查询切片问题](q017.md)
- [多协程查询切片问题](q018.md)
- [多协程查询切片问题](q019.md)
- [字符串转成byte数组,会发生内存拷贝吗?](q020.md)
- [http包的内存泄漏](q021.md)
- [sync.Map 的用法](q022.md)
- [Golang基础语法相关题目](q023.md)
4 changes: 2 additions & 2 deletions question/q013.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## 为 sync.WaitGroup 中Wait函数支持 WaitTimeout 功能.

## 为 sync.WaitGroup 中Wait函数支持 WaitTimeout 功能.`
`
```go
package main

Expand Down
1 change: 1 addition & 0 deletions question/q021.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func main() {
## 怎么答

不进行resp.Body.Close(),泄漏是一定的。但是泄漏的goroutine个数就让我迷糊了。由于执行了6遍,每次泄漏一个读和写goroutine,就是12个goroutine,加上main函数本身也是一个goroutine,所以答案是13.

然而执行程序,发现答案是3,出入有点大,为什么呢?

## 解释
Expand Down
Loading

0 comments on commit 189d985

Please sign in to comment.