mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
added a /gc endpoint to debug filestore memory usage
This commit is contained in:
parent
9b84422092
commit
e1683b8e1c
1 changed files with 11 additions and 0 deletions
|
@ -85,6 +85,17 @@ app.post "/project/:project_id/public/:public_file_id", keyBuilder.publicFileKey
|
|||
app.put "/project/:project_id/public/:public_file_id", keyBuilder.publicFileKey, fileController.copyFile
|
||||
app.del "/project/:project_id/public/:public_file_id", keyBuilder.publicFileKey, fileController.deleteFile
|
||||
|
||||
app.get "/gc", (req, res)->
|
||||
if global.gc?
|
||||
memory_before = process.memoryUsage()
|
||||
global.gc()
|
||||
memory_after = process.memoryUsage()
|
||||
delta = {}
|
||||
for k of memory_after
|
||||
delta[k] = memory_after[k] - memory_before[k]
|
||||
res.send { memory_before, memory_after, delta }
|
||||
else
|
||||
res.send(501) # need --expose-gc, send "not implemented"
|
||||
|
||||
app.get "/heapdump", (req, res)->
|
||||
require('heapdump').writeSnapshot '/tmp/' + Date.now() + '.filestore.heapsnapshot', (err, filename)->
|
||||
|
|
Loading…
Reference in a new issue