How do I print the call stack size for a nodejs program












1














My program keeps hitting a stack overflow despite me allocating it 7 gb of ram. I need to find out where all this memory usage is coming from. My program is a series of for loops and it stops about one quarter of the way through and increasing the stack size helped it get a little farther so I know it is not an infinite loop.



Is there a way to print the callstack size? I am not finding anything online. If I can do that maybe I can hunt down this memory leak.



EDIT: this is in node.










share|improve this question
























  • Is this code being run in the browser or is it nodejs?
    – rubentd
    Nov 9 '18 at 16:57










  • do things in chunks
    – Microsmsm
    Nov 9 '18 at 17:01










  • @rubentd It's in node
    – user10302261
    Nov 9 '18 at 17:08










  • @Microsmsm I can't do this operation in chunks because I need to iterate over every group of arrays with every other group of arrays. It's one process.
    – user10302261
    Nov 9 '18 at 17:09










  • Do you have recursion by any chance?
    – rubentd
    Nov 9 '18 at 17:11
















1














My program keeps hitting a stack overflow despite me allocating it 7 gb of ram. I need to find out where all this memory usage is coming from. My program is a series of for loops and it stops about one quarter of the way through and increasing the stack size helped it get a little farther so I know it is not an infinite loop.



Is there a way to print the callstack size? I am not finding anything online. If I can do that maybe I can hunt down this memory leak.



EDIT: this is in node.










share|improve this question
























  • Is this code being run in the browser or is it nodejs?
    – rubentd
    Nov 9 '18 at 16:57










  • do things in chunks
    – Microsmsm
    Nov 9 '18 at 17:01










  • @rubentd It's in node
    – user10302261
    Nov 9 '18 at 17:08










  • @Microsmsm I can't do this operation in chunks because I need to iterate over every group of arrays with every other group of arrays. It's one process.
    – user10302261
    Nov 9 '18 at 17:09










  • Do you have recursion by any chance?
    – rubentd
    Nov 9 '18 at 17:11














1












1








1


0





My program keeps hitting a stack overflow despite me allocating it 7 gb of ram. I need to find out where all this memory usage is coming from. My program is a series of for loops and it stops about one quarter of the way through and increasing the stack size helped it get a little farther so I know it is not an infinite loop.



Is there a way to print the callstack size? I am not finding anything online. If I can do that maybe I can hunt down this memory leak.



EDIT: this is in node.










share|improve this question















My program keeps hitting a stack overflow despite me allocating it 7 gb of ram. I need to find out where all this memory usage is coming from. My program is a series of for loops and it stops about one quarter of the way through and increasing the stack size helped it get a little farther so I know it is not an infinite loop.



Is there a way to print the callstack size? I am not finding anything online. If I can do that maybe I can hunt down this memory leak.



EDIT: this is in node.







javascript node.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 19:26









rubentd

1,077821




1,077821










asked Nov 9 '18 at 16:56







user10302261



















  • Is this code being run in the browser or is it nodejs?
    – rubentd
    Nov 9 '18 at 16:57










  • do things in chunks
    – Microsmsm
    Nov 9 '18 at 17:01










  • @rubentd It's in node
    – user10302261
    Nov 9 '18 at 17:08










  • @Microsmsm I can't do this operation in chunks because I need to iterate over every group of arrays with every other group of arrays. It's one process.
    – user10302261
    Nov 9 '18 at 17:09










  • Do you have recursion by any chance?
    – rubentd
    Nov 9 '18 at 17:11


















  • Is this code being run in the browser or is it nodejs?
    – rubentd
    Nov 9 '18 at 16:57










  • do things in chunks
    – Microsmsm
    Nov 9 '18 at 17:01










  • @rubentd It's in node
    – user10302261
    Nov 9 '18 at 17:08










  • @Microsmsm I can't do this operation in chunks because I need to iterate over every group of arrays with every other group of arrays. It's one process.
    – user10302261
    Nov 9 '18 at 17:09










  • Do you have recursion by any chance?
    – rubentd
    Nov 9 '18 at 17:11
















Is this code being run in the browser or is it nodejs?
– rubentd
Nov 9 '18 at 16:57




Is this code being run in the browser or is it nodejs?
– rubentd
Nov 9 '18 at 16:57












do things in chunks
– Microsmsm
Nov 9 '18 at 17:01




do things in chunks
– Microsmsm
Nov 9 '18 at 17:01












@rubentd It's in node
– user10302261
Nov 9 '18 at 17:08




@rubentd It's in node
– user10302261
Nov 9 '18 at 17:08












@Microsmsm I can't do this operation in chunks because I need to iterate over every group of arrays with every other group of arrays. It's one process.
– user10302261
Nov 9 '18 at 17:09




@Microsmsm I can't do this operation in chunks because I need to iterate over every group of arrays with every other group of arrays. It's one process.
– user10302261
Nov 9 '18 at 17:09












Do you have recursion by any chance?
– rubentd
Nov 9 '18 at 17:11




Do you have recursion by any chance?
– rubentd
Nov 9 '18 at 17:11












1 Answer
1






active

oldest

votes


















0














If this is for nodejs, try running it with the --inspect flag./ this article might be helpful for you: https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27



Or try using process.memoryUsage() and print the result to debug it.



If it's a browser code, try the Performance tab on chrome dev tools.






share|improve this answer























  • Is there another way besides using chrome dev tools? I just want to console.log the stack size. It should be doable I would think because the error message thrown when you exceed the stack size shows you what the stack size is.
    – user10302261
    Nov 9 '18 at 17:23






  • 1




    try console.log(process.memoryUsage());
    – rubentd
    Nov 9 '18 at 17:28












  • That'll do it! thanks.
    – user10302261
    Nov 9 '18 at 19:22











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230151%2fhow-do-i-print-the-call-stack-size-for-a-nodejs-program%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown
























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














If this is for nodejs, try running it with the --inspect flag./ this article might be helpful for you: https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27



Or try using process.memoryUsage() and print the result to debug it.



If it's a browser code, try the Performance tab on chrome dev tools.






share|improve this answer























  • Is there another way besides using chrome dev tools? I just want to console.log the stack size. It should be doable I would think because the error message thrown when you exceed the stack size shows you what the stack size is.
    – user10302261
    Nov 9 '18 at 17:23






  • 1




    try console.log(process.memoryUsage());
    – rubentd
    Nov 9 '18 at 17:28












  • That'll do it! thanks.
    – user10302261
    Nov 9 '18 at 19:22
















0














If this is for nodejs, try running it with the --inspect flag./ this article might be helpful for you: https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27



Or try using process.memoryUsage() and print the result to debug it.



If it's a browser code, try the Performance tab on chrome dev tools.






share|improve this answer























  • Is there another way besides using chrome dev tools? I just want to console.log the stack size. It should be doable I would think because the error message thrown when you exceed the stack size shows you what the stack size is.
    – user10302261
    Nov 9 '18 at 17:23






  • 1




    try console.log(process.memoryUsage());
    – rubentd
    Nov 9 '18 at 17:28












  • That'll do it! thanks.
    – user10302261
    Nov 9 '18 at 19:22














0












0








0






If this is for nodejs, try running it with the --inspect flag./ this article might be helpful for you: https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27



Or try using process.memoryUsage() and print the result to debug it.



If it's a browser code, try the Performance tab on chrome dev tools.






share|improve this answer














If this is for nodejs, try running it with the --inspect flag./ this article might be helpful for you: https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27



Or try using process.memoryUsage() and print the result to debug it.



If it's a browser code, try the Performance tab on chrome dev tools.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 9 '18 at 17:29

























answered Nov 9 '18 at 17:02









rubentd

1,077821




1,077821












  • Is there another way besides using chrome dev tools? I just want to console.log the stack size. It should be doable I would think because the error message thrown when you exceed the stack size shows you what the stack size is.
    – user10302261
    Nov 9 '18 at 17:23






  • 1




    try console.log(process.memoryUsage());
    – rubentd
    Nov 9 '18 at 17:28












  • That'll do it! thanks.
    – user10302261
    Nov 9 '18 at 19:22


















  • Is there another way besides using chrome dev tools? I just want to console.log the stack size. It should be doable I would think because the error message thrown when you exceed the stack size shows you what the stack size is.
    – user10302261
    Nov 9 '18 at 17:23






  • 1




    try console.log(process.memoryUsage());
    – rubentd
    Nov 9 '18 at 17:28












  • That'll do it! thanks.
    – user10302261
    Nov 9 '18 at 19:22
















Is there another way besides using chrome dev tools? I just want to console.log the stack size. It should be doable I would think because the error message thrown when you exceed the stack size shows you what the stack size is.
– user10302261
Nov 9 '18 at 17:23




Is there another way besides using chrome dev tools? I just want to console.log the stack size. It should be doable I would think because the error message thrown when you exceed the stack size shows you what the stack size is.
– user10302261
Nov 9 '18 at 17:23




1




1




try console.log(process.memoryUsage());
– rubentd
Nov 9 '18 at 17:28






try console.log(process.memoryUsage());
– rubentd
Nov 9 '18 at 17:28














That'll do it! thanks.
– user10302261
Nov 9 '18 at 19:22




That'll do it! thanks.
– user10302261
Nov 9 '18 at 19:22


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53230151%2fhow-do-i-print-the-call-stack-size-for-a-nodejs-program%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()