douyao1856 2019-02-12 19:33
浏览 292
已采纳

runtime.memclrNoHeapPointers是做什么的?

I am profiling a library and see that a function called runtime.memclrNoHeapPointers is taking up about 0.82seconds of the cpu-time.

What does this function do, and what does this tell me about the memory-usage of the library i am profiling?

The output, for completeness:

File: gribtest.test
Type: cpu
Time: Feb 12, 2019 at 8:27pm (CET)
Duration: 5.21s, Total samples = 5.11s (98.15%)
Showing nodes accounting for 4.94s, 96.67% of 5.11s total
Dropped 61 nodes (cum <= 0.03s)
      flat  flat%   sum%        cum   cum%
     1.60s 31.31% 31.31%      1.81s 35.42%  github.com/nilsmagnus/grib/griblib.(*BitReader).readBit
     1.08s 21.14% 52.45%      2.89s 56.56%  github.com/nilsmagnus/grib/griblib.(*BitReader).readUint
     0.37s  7.24% 59.69%      0.82s 16.05%  encoding/binary.(*decoder).value
     0.35s  6.85% 66.54%      0.35s  6.85%  runtime.memclrNoHeapPointers
  • 写回答

1条回答 默认 最新

  • duan2477 2019-02-12 20:49
    关注

    func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)

    memclrNoHeapPointers clears n bytes starting at ptr.

    Usually you should use typedmemclr. memclrNoHeapPointers should be used only when the caller knows that *ptr contains no heap pointers because either:

    1. *ptr is initialized memory and its type is pointer-free.

    2. *ptr is uninitialized memory (e.g., memory that's being reused

    for a new allocation) and hence contains only "junk".

    in memclr_*.s go:noescape

    See https://github.com/golang/go/blob/9e277f7d554455e16ba3762541c53e9bfc1d8188/src/runtime/stubs.go#L78

    This is part of the garbage collector. You can see the declaration here.

    The specifics of what it does are CPU dependent. See the various memclr_*.s files in the runtime for implmentation

    This does seem like a long time in the GC, but it's hard to say something about the memory usage of the library with just the data you've shown I think.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b