aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-09-11 15:33:18 +0800
committerGitHub <noreply@github.com>2017-09-11 15:33:18 +0800
commit5596b664c4ca5be199bb93f87155fa2c1fa7eab2 (patch)
tree2bcf87f69fc036695e079356459bc78dbb1a0cec /internal
parent10181b57a9fb648f5fd424ca611820a3cf42c42b (diff)
downloadgo-tangerine-5596b664c4ca5be199bb93f87155fa2c1fa7eab2.tar
go-tangerine-5596b664c4ca5be199bb93f87155fa2c1fa7eab2.tar.gz
go-tangerine-5596b664c4ca5be199bb93f87155fa2c1fa7eab2.tar.bz2
go-tangerine-5596b664c4ca5be199bb93f87155fa2c1fa7eab2.tar.lz
go-tangerine-5596b664c4ca5be199bb93f87155fa2c1fa7eab2.tar.xz
go-tangerine-5596b664c4ca5be199bb93f87155fa2c1fa7eab2.tar.zst
go-tangerine-5596b664c4ca5be199bb93f87155fa2c1fa7eab2.zip
internal/debug: add debug_freeOSMemory (#15122)
Diffstat (limited to 'internal')
-rw-r--r--internal/debug/api.go5
-rw-r--r--internal/web3ext/web3ext.go134
2 files changed, 68 insertions, 71 deletions
diff --git a/internal/debug/api.go b/internal/debug/api.go
index 8b7693f6a..7583878ed 100644
--- a/internal/debug/api.go
+++ b/internal/debug/api.go
@@ -176,6 +176,11 @@ func (*HandlerT) Stacks() string {
return string(buf)
}
+// FreeOSMemory returns unused memory to the OS.
+func (*HandlerT) FreeOSMemory() {
+ debug.FreeOSMemory()
+}
+
func writeProfile(name, file string) error {
p := pprof.Lookup(name)
log.Info("Writing profile records", "count", p.Count(), "type", name, "dump", file)
diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go
index bf1db8819..927085b44 100644
--- a/internal/web3ext/web3ext.go
+++ b/internal/web3ext/web3ext.go
@@ -34,58 +34,56 @@ var Modules = map[string]string{
const Chequebook_JS = `
web3._extend({
- property: 'chequebook',
- methods:
- [
- new web3._extend.Method({
- name: 'deposit',
- call: 'chequebook_deposit',
- params: 1,
- inputFormatter: [null]
- }),
- new web3._extend.Property({
+ property: 'chequebook',
+ methods: [
+ new web3._extend.Method({
+ name: 'deposit',
+ call: 'chequebook_deposit',
+ params: 1,
+ inputFormatter: [null]
+ }),
+ new web3._extend.Property({
name: 'balance',
getter: 'chequebook_balance',
- outputFormatter: web3._extend.utils.toDecimal
- }),
- new web3._extend.Method({
- name: 'cash',
- call: 'chequebook_cash',
- params: 1,
- inputFormatter: [null]
- }),
- new web3._extend.Method({
- name: 'issue',
- call: 'chequebook_issue',
- params: 2,
- inputFormatter: [null, null]
- }),
- ]
+ outputFormatter: web3._extend.utils.toDecimal
+ }),
+ new web3._extend.Method({
+ name: 'cash',
+ call: 'chequebook_cash',
+ params: 1,
+ inputFormatter: [null]
+ }),
+ new web3._extend.Method({
+ name: 'issue',
+ call: 'chequebook_issue',
+ params: 2,
+ inputFormatter: [null, null]
+ }),
+ ]
});
`
const Clique_JS = `
web3._extend({
- property: 'clique',
- methods:
- [
+ property: 'clique',
+ methods: [
new web3._extend.Method({
name: 'getSnapshot',
call: 'clique_getSnapshot',
params: 1,
- inputFormatter: [null]
+ inputFormatter: [null]
}),
new web3._extend.Method({
name: 'getSnapshotAtHash',
call: 'clique_getSnapshotAtHash',
params: 1
}),
- new web3._extend.Method({
- name: 'getSigners',
- call: 'clique_getSigners',
- params: 1,
- inputFormatter: [null]
- }),
+ new web3._extend.Method({
+ name: 'getSigners',
+ call: 'clique_getSigners',
+ params: 1,
+ inputFormatter: [null]
+ }),
new web3._extend.Method({
name: 'getSignersAtHash',
call: 'clique_getSignersAtHash',
@@ -100,10 +98,9 @@ web3._extend({
name: 'discard',
call: 'clique_discard',
params: 1
- })
- ],
- properties:
- [
+ }),
+ ],
+ properties: [
new web3._extend.Property({
name: 'proposals',
getter: 'clique_proposals'
@@ -115,8 +112,7 @@ web3._extend({
const Admin_JS = `
web3._extend({
property: 'admin',
- methods:
- [
+ methods: [
new web3._extend.Method({
name: 'addPeer',
call: 'admin_addPeer',
@@ -162,10 +158,9 @@ web3._extend({
new web3._extend.Method({
name: 'stopWS',
call: 'admin_stopWS'
- })
+ }),
],
- properties:
- [
+ properties: [
new web3._extend.Property({
name: 'nodeInfo',
getter: 'admin_nodeInfo'
@@ -177,7 +172,7 @@ web3._extend({
new web3._extend.Property({
name: 'datadir',
getter: 'admin_datadir'
- })
+ }),
]
});
`
@@ -185,8 +180,7 @@ web3._extend({
const Debug_JS = `
web3._extend({
property: 'debug',
- methods:
- [
+ methods: [
new web3._extend.Method({
name: 'printBlock',
call: 'debug_printBlock',
@@ -269,6 +263,11 @@ web3._extend({
outputFormatter: console.log
}),
new web3._extend.Method({
+ name: 'freeOSMemory',
+ call: 'debug_freeOSMemory',
+ params: 0,
+ }),
+ new web3._extend.Method({
name: 'memStats',
call: 'debug_memStats',
params: 0,
@@ -358,8 +357,7 @@ web3._extend({
const Eth_JS = `
web3._extend({
property: 'eth',
- methods:
- [
+ methods: [
new web3._extend.Method({
name: 'sign',
call: 'eth_sign',
@@ -396,10 +394,9 @@ web3._extend({
},
params: 2,
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
- })
+ }),
],
- properties:
- [
+ properties: [
new web3._extend.Property({
name: 'pendingTransactions',
getter: 'eth_pendingTransactions',
@@ -411,7 +408,7 @@ web3._extend({
}
return formatted;
}
- })
+ }),
]
});
`
@@ -419,8 +416,7 @@ web3._extend({
const Miner_JS = `
web3._extend({
property: 'miner',
- methods:
- [
+ methods: [
new web3._extend.Method({
name: 'start',
call: 'miner_start',
@@ -451,7 +447,7 @@ web3._extend({
new web3._extend.Method({
name: 'getHashrate',
call: 'miner_getHashrate'
- })
+ }),
],
properties: []
});
@@ -461,12 +457,11 @@ const Net_JS = `
web3._extend({
property: 'net',
methods: [],
- properties:
- [
+ properties: [
new web3._extend.Property({
name: 'version',
getter: 'net_version'
- })
+ }),
]
});
`
@@ -474,8 +469,7 @@ web3._extend({
const Personal_JS = `
web3._extend({
property: 'personal',
- methods:
- [
+ methods: [
new web3._extend.Method({
name: 'importRawKey',
call: 'personal_importRawKey',
@@ -501,14 +495,13 @@ web3._extend({
name: 'deriveAccount',
call: 'personal_deriveAccount',
params: 3
- })
+ }),
],
- properties:
- [
+ properties: [
new web3._extend.Property({
name: 'listWallets',
getter: 'personal_listWallets'
- })
+ }),
]
})
`
@@ -517,12 +510,11 @@ const RPC_JS = `
web3._extend({
property: 'rpc',
methods: [],
- properties:
- [
+ properties: [
new web3._extend.Property({
name: 'modules',
getter: 'rpc_modules'
- })
+ }),
]
});
`
@@ -633,7 +625,7 @@ web3._extend({
name: 'newMessageFilter',
call: 'shh_newMessageFilter',
params: 1
- })
+ }),
],
properties:
[
@@ -669,7 +661,7 @@ web3._extend({
name: 'listmounts',
call: 'swarmfs_listmounts',
params: 0
- })
+ }),
]
});
`
@@ -696,7 +688,7 @@ web3._extend({
status.queued = web3._extend.utils.toDecimal(status.queued);
return status;
}
- })
+ }),
]
});
`