node.js 中的共享内存池是什么
What is Shared Internal Memory Pool in node.js
node.js的文档中关于Buffer.allocUnsafe()
和Buffer.allocUnSafeSlow()
的描述是:
Buffer instances returned by Buffer.allocUnsafe() may be allocated off a shared internal memory pool if size is less than or equal to half Buffer.poolSize. Instances returned by Buffer.allocUnsafeSlow() never use the shared internal memory pool.
我不明白shared internal memory pool
的意思,谁能帮我解释一下?非常感谢。
Node.js Buffer 模块预先分配一个大小为 Buffer.poolSize
的内部 Buffer 实例,用作 "Pool" 用于快速分配
Buffer.allocUnsafe()
方法使用此(如果其大小允许)进行 'fast' 分配
Buffer.allocUnsafeSlow()
不使用此池,这就是它被称为 'slow' 的原因
node.js的文档中关于Buffer.allocUnsafe()
和Buffer.allocUnSafeSlow()
的描述是:
Buffer instances returned by Buffer.allocUnsafe() may be allocated off a shared internal memory pool if size is less than or equal to half Buffer.poolSize. Instances returned by Buffer.allocUnsafeSlow() never use the shared internal memory pool.
我不明白shared internal memory pool
的意思,谁能帮我解释一下?非常感谢。
Node.js Buffer 模块预先分配一个大小为 Buffer.poolSize
的内部 Buffer 实例,用作 "Pool" 用于快速分配
Buffer.allocUnsafe()
方法使用此(如果其大小允许)进行 'fast' 分配Buffer.allocUnsafeSlow()
不使用此池,这就是它被称为 'slow' 的原因