小编sha*_*ind的帖子

如何分析golang内存?

我写了一个golang程序,它在运行时使用1.2GB的内存.

调用go tool pprof http://10.10.58.118:8601/debug/pprof/heap只有323.4MB堆使用量的转储结果.

  • 剩下的内存使用情况如何?
  • 有没有更好的工具来解释golang运行时内存?

使用gcvis我得到这个:

在此输入图像描述

..和这个堆形式配置文件:

在此输入图像描述

这是我的代码:https://github.com/sharewind/push-server/blob/v3/broker

memory profile performance go

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

通过ssh杀死远程进程

我无法直接访问目标主机,需要ssh作为代理.

如何从本地使用ssh杀死进程?我试试这个:

ssh root@$center "ssh root@$ip \"ps -ef|grep -v grep|grep $target_dir/$main|awk '{print \$2}'|xargs kill\""
Run Code Online (Sandbox Code Playgroud)

它有错误:

kill: can't find process "root"
Run Code Online (Sandbox Code Playgroud)

如何避免过程不存在的错误?

linux ssh shell

6
推荐指数
2
解决办法
2万
查看次数

为什么我得到EXC_BAD_ACCESS?

我想反转一个字符串,但我在swap char上出错了.

有人可以帮我吗?

char*  reverse_char(char* src){
    char *p,*q;
    p = q = src;
    while(*(p) != '\0'){
        p++;
    }
    p--;

    char  temp = '\0';
    while (p > q) {
        temp = *p;
        *p = *q; // I got exec bad access here ??? why 
        *q = temp;
        p--;
        q++;
    }
    return src;
}
Run Code Online (Sandbox Code Playgroud)

这是主要方法.

int main(int argc, char const* argv[])
{
    char *hi = "hello world!\n";
    printf("%s", hi);

    reverse_char(hi);
    printf("%s", hi);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c exc-bad-access

0
推荐指数
1
解决办法
1563
查看次数

标签 统计

c ×1

exc-bad-access ×1

go ×1

linux ×1

memory ×1

performance ×1

profile ×1

shell ×1

ssh ×1