This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
const msgpack = require('msgpack5')(); | |
const msgpacklite = require("msgpack-lite"); | |
const obj = {name: "jonathan", age: 29, gender: "male"}; | |
const count = 100000; | |
const try5 = (act) => { | |
if (act === "encode") { | |
for (let i = 0; i < count; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $ node -v | |
// v8.4.0 | |
// node --max-old-space-size=8192 | |
"use strict"; | |
var v8 = require("v8"); | |
console.log(v8.getHeapStatistics()); | |
// { total_heap_size: 9437184, | |
// total_heap_size_executable: 3145728, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $ node -v | |
// v8.4.0 | |
"use strict"; | |
var v8 = require("v8"); | |
console.log(v8.getHeapStatistics()); | |
// { total_heap_size: 9437184, | |
// total_heap_size_executable: 3145728, | |
// total_physical_size: 6928200, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// $ node -v | |
// v8.4.0 | |
/** | |
Debug输出信息的查看,使用: | |
DEBUG=MEM:* node xxx.js | |
查看内存输出日志: | |
DEBUG=MEM:ReportMemory node ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node --expose-gc --trace-gc --trace-gc-verbose ./cases/leak-and-gc.js --normal | |
[44972:0x103000000] Fast promotion mode: false survival rate: 57% | |
[44972:0x103000000] 60 ms: Scavenge 3.0 (5.5) -> 2.7 (6.5) MB, 1.2 / 0.0 ms allocation failure | |
[44972:0x103000000] Memory allocator, used: 6656 KB, available: 1459712 KB | |
[44972:0x103000000] New space, used: 581 KB, available: 425 KB, committed: 2048 KB | |
[44972:0x103000000] Old space, used: 778 KB, available: 0 KB, committed: 1024 KB | |
[44972:0x103000000] Code space, used: 1180 KB, available: 1 KB, committed: 1536KB | |
[44972:0x103000000] Map space, used: 201 KB, available: 0 KB, committed: 512 KB | |
[44972:0x103000000] Large object space, used: 0 KB, available: 1459191 KB, committed: 0 KB | |
[44972:0x103000000] All spaces, used: 2741 KB, available: 1459617 KB, committed: 5120KB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
// node --expose-gc --trace-gc cases/leak-and-gc.js --normal | node cases/pipe-gc-parser.js | |
// node --expose-gc --trace-gc-nvp cases/leak-and-gc.js --normal | node cases/pipe-gc-parser.js | |
"use strict"; | |
const readline = require("readline"); | |
const GcParser = require("v8-gc-log-parser"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as $protobuf from "protobufjs"; | |
/** Namespace com. */ | |
export namespace com { | |
/** Namespace book. */ | |
namespace book { | |
/** Properties of a Book. */ | |
interface IBook { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package: com.book | |
// file: book/book.proto | |
import * as grpc from "grpc"; | |
import * as book_book_pb from "../book/book_pb"; | |
interface IBookServiceService extends grpc.IMethodsMap { | |
getBook: IGetBook; | |
getBooksViaAuthor: IGetBooksViaAuthor; | |
getGreatestBook: IGetGreatestBook; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"swagger": "2.0", | |
"info": { | |
"title": "book/book.proto", | |
"version": "version not set" | |
}, | |
"schemes": [ | |
"http", | |
"https" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "profile", | |
"version": "0.0.1", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "MIT", |
OlderNewer