小编Sa *_* Oh的帖子

kmalloc-256似乎占用了大部分内存资源。我该如何释放它?

我有一个Linux ip-xxx 4.9.20-11.31.amzn1.x86_64 #1运行Jenkins 的Linux实例(Amazon Linux )。由于作业所需的内存不足,它有时会停止工作。

根据我对freecommand和的调查/proc/meminfo,似乎Slab占用了实例上可用的大部分内存。

[root@ip-xxx ~]# free -tm
             total       used       free     shared    buffers     cached
Mem:          7985       7205        779          0         19        310
-/+ buffers/cache:       6876       1108
Swap:            0          0          0
Total:        7985       7205        779

[root@ip-xxx ~]# cat /proc/meminfo | grep "Slab\|claim"
Slab:            6719244 kB
SReclaimable:      34288 kB
SUnreclaim:      6684956 kB
Run Code Online (Sandbox Code Playgroud)

我可以找到dentry通过运行清除缓存的方法echo 3 > /proc/sys/vm/drop_caches,但是如何清除kmalloc-256?或者,是否可以找到正在使用kmalloc-256内存空间的进程?

[root@ip-xxx ~]# slabtop -o | head -n …
Run Code Online (Sandbox Code Playgroud)

linux memory

6
推荐指数
0
解决办法
333
查看次数

当我尝试使用“ net / http”获取某些图像时,为什么会收到“ net / http:等待连接时请求已取消”的信息

我正在用Go语言编写网络爬虫,以在Internet上收集图像。我的搜寻器大部分时间都在工作,但有时无法以某种方式获取图像。

这是我的片段:

package main

import (
    "fmt"
    "net/http"
    "time"
)

func main() {
    var client http.Client
    var resp *http.Response

    // var imageUrl = "https://i.stack.imgur.com/tKsDb.png"  // It works well
    var imageUrl = "https://precious.jp/mwimgs/b/1/-/img_b1ec6cf54ff3a4260fb77d3d3de918a5275780.jpg"  // It fails

    req, _ := http.NewRequest("GET", imageUrl, nil)
    req.Header.Add("User-Agent", "My Test")

    client.Timeout = 3 * time.Second
    resp, err := client.Do(req)
    if err != nil {
        fmt.Println(err.Error())  // Fails here
        return
    }
    defer resp.Body.Close()

    if resp.StatusCode != http.StatusOK {
        fmt.Printf("Failure: %d\n", resp.StatusCode)
    } else {
        fmt.Printf("Success: %d\n", resp.StatusCode) …
Run Code Online (Sandbox Code Playgroud)

networking http go

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

go ×1

http ×1

linux ×1

memory ×1

networking ×1