Skip to content

Memory Leak on v16.0.0-pre #38958

Description

@luhuaipei

The pss/rss of the heap in /proc/pid/smaps will increase about 52k every time when I execute following code:
Please help to figure it out.

Thanks.

function newDate(){                                                              
    sysTime = new Date().toLocaleTimeString('en-US')                             
}                                                                                
                                                                                 
setInterval(newDate, 1000);   

And when I remove the parameter "en-US" of toLocaleTimeString, the program doesn't leak.

Activity

  1. bl-ue commented on Jun 7, 2021

    @bl-ue
  2. transferred this issue fromnodejs/Releaseon Jun 7, 2021
  3. Ayase-252 commented on Jun 7, 2021

    @Ayase-252
    Member

    Does the issue happened on v16.3.0 or master(v17.0.0-pre)?

  4. luhuaipei commented on Jun 8, 2021

    @luhuaipei
    Author

    @Ayase-252 Hi

    Here is the test result:
    tag v14.17.0 NG
    tag v15.14.0 NG
    v16. 0. 0 OK
    v16. 3. 0 OK

  5. Ayase-252 commented on Jun 8, 2021

    @Ayase-252
    Member

    Here is the test result:
    tag v14.17.0 NG
    tag v15.14.0 NG
    v16. 0. 0 OK
    v16. 3. 0 OK

    @luhuaipei
    So... it looks fixed in v16. I suspect that #38178 fixed the issue since it is the only ICU-related change in v16.0.0 release and it will be release in v14.17.1 soon. You could try at that time.

  6. added
    i18n-apiIssues and PRs related to Node.js internationalization support.
    on Jun 8, 2021
  7. luhuaipei commented on Jun 9, 2021

    @luhuaipei
    Author

    @Ayase-252 Thanks. I cherry-picked the patch to my local, the issue still exists. Do you have other suggestions?

  8. Ayase-252 commented on Jun 9, 2021

    @Ayase-252
    Member

    @luhuaipei Sorry, I don't have a clue now.

    cc @nodejs/i18n-api

  9. luhuaipei commented on Jun 9, 2021

    @luhuaipei
    Author

    It seems the issue resides in v8. I use the d8 tool in V8(version 8.8.6) can reproduce this issue.

    In d8 console, every time I execute

    new Date().toLocaleTimeString('en-US')
    

    The Rss section will increase by 52-56Kb.

  10. targos commented on Jun 9, 2021

    @targos
    Member

    @nodejs/v8

  11. added
    memoryIssues and PRs related to Node.js memory management or memory footprint.
    v8 engineIssues and PRs related to the V8 dependency.
    on Jun 9, 2021
  12. luhuaipei commented on Jun 9, 2021

    @luhuaipei
    Author

    v8/v8@4b139f7

    This patch indroduced the fix in v8 version(8.9.1)

  13. gengjiawen commented on Jun 9, 2021

    @gengjiawen
    Member

    v8/v8@4b139f7

    This patch indroduced the fix in v8 version(8.9.1)

    @gsathya Can you take a look ?

  14. gengjiawen commented on Jun 13, 2021

    @gengjiawen
    Member

    v8/v8@4b139f7
    This patch indroduced the fix in v8 version(8.9.1)

    @gsathya Can you take a look ?

    cc @verwaest Is this you can help ?

  15. nikikalwar commented on Jun 17, 2021

    @nikikalwar

    Hi All,
    I took a look and it really exists, interested in working on it.
    `let my_process=process;
    function getTime(){
    console.log(new Date().toLocaleTimeString('en-US'));
    console.log(my_process.memoryUsage())
    }

    setInterval(getTime,2000)

    `

  16. bl-ue commented on Jun 17, 2021

    @bl-ue
    Contributor

    @nikikalwar the best way to fix it would be to take a look at the commit v8/v8@4b139f7 and figure out just what in that commit started making it so slow.

  17. targos commented on May 3, 2023

    @targos
    Member

    Closing as v14.x is EoL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    i18n-apiIssues and PRs related to Node.js internationalization support.memoryIssues and PRs related to Node.js memory management or memory footprint.v8 engineIssues and PRs related to the V8 dependency.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions