Giter Club home page Giter Club logo

Comments (3)

dop251 avatar dop251 commented on September 18, 2024

Hi. Although this is not the most optimal usage scenario, the code does not contain memory leaks. How do you measure the memory usage? Could you try running it with GODEBUG=gctrace=1?

from goja.

zengming00 avatar zengming00 commented on September 18, 2024

Thank you, i don't known how to measure the memory usage.
i just run it on windows and look in the task manager.
After half an hour, memory is back below 100MīŧŒ It may not be a memory leak . 😀

this is try running it with GODEBUG=gctrace=1 logs, i removed some unhelpful log

gc 1 @0.309s 0%: 0+210+0 ms clock, 0+522/210/58+0 ms cpu, 83->84->77 MB, 84 MB goal, 4 P
gc 2 @0.532s 0%: 0+413+2.0 ms clock, 0+11/409/431+8.1 ms cpu, 78->95->93 MB, 154 MB goal, 4 P
gc 3 @1.283s 0%: 2017/12/27 19:41:41 a.js init
+262/488/0+0 ms cpu, 130->154->96 MB, 187 MB goal, 4 P
gc 4 @2.097s 0%: 0+375+0 ms clock, 0+167/374/58+0 ms cpu, 144->161->73 MB, 193 MB goal, 4 P
gc 5 @2.784s 0%: 0+245+0 ms clock, 0+191/244/33+0 ms cpu, 119->129->57 MB, 146 MB goal, 4 P
gc 6 @3.312s 0%: 1.0+186+0 ms clock, 4.0+196/185/0+0 ms cpu, 97->104->47 MB, 115 MB goal, 4 P
gc 7 @3.737s 0%: 0+150+0 ms clock, 0+194/149/0+0 ms cpu, 81->86->39 MB, 94 MB goal, 4 P
gc 8 @4.078s 0%: 0+147+0.50 ms clock, 0+88/145/81+2.0 ms cpu, 68->72->33 MB, 79 MB goal, 4 P
gc 9 @4.399s 0%: 0+98+0 ms clock, 0+157/97/0+0 ms cpu, 59->62->27 MB, 66 MB goal, 4 P
gc 10 @4.643s 0%: 0+85+0 ms clock, 0+127/84/0+0 ms cpu, 49->52->23 MB, 55 MB goal, 4 P
gc 11 @4.851s 0%: 0+75+0 ms clock, 0+55/74/56+0 ms cpu, 42->44->20 MB, 47 MB goal, 4 P
gc 12 @5.035s 0%: 0+59+0 ms clock, 0+101/58/0+0 ms cpu, 37->38->17 MB, 41 MB goal, 4 P
gc 13 @5.214s 0%: 0+60+0 ms clock, 0+27/60/56+0 ms cpu, 31->32->14 MB, 34 MB goal, 4 P
gc 14 @5.356s 0%: 0+40+0 ms clock, 0+68/39/0+0 ms cpu, 27->28->12 MB, 29 MB goal, 4 P
gc 15 @5.463s 0%: 0+34+0 ms clock, 0+60/33/0+0 ms cpu, 22->23->10 MB, 25 MB goal, 4 P
gc 16 @5.551s 0%: 1.0+32+0 ms clock, 4.0+41/31/4.0+02017/12/27 19:41:45 a.js init
 ms cpu, 19->20->9 MB, 21 MB goal, 4 P
gc 17 @5.633s 0%: 0+28+0 ms clock, 0+41/27/0+0 ms cpu, 17->17->8 MB, 18 MB goal, 4 P
gc 18 @5.709s 0%: 0+23+0 ms clock, 0+35/23/0+0 ms cpu, 14->15->7 MB, 16 MB goal, 4 P
gc 2017/12/27 19:41:45 a.js init
 @5.769s 0%: 2017/12/27 19:41:45 a.js foo()
gc 20 @5.822s 0%: 0+18+0 ms clock, 0+19/18/0+0 ms cpu, 11->11->5 MB, 12 MB goal, 4 P
gc 21 @5.868s 0%: 0+15+0 ms clock, 0+3.9/14/14+0 ms cpu, 9->10->4 MB, 11 MB goal, 4 P
gc 22 @5.909s 0%: 2017/12/27 19:41:45 a.js init

from goja.

dop251 avatar dop251 commented on September 18, 2024

Go does not free OS memory immediately, there is a background process that will do it eventually but there are no guarantees as to when.

from goja.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.