Java: memory issue

Revision en1, by F__, 2019-07-09 19:11:22

These two solutions java(4532MB) cpp(18MB) of EDIST are same but java solution is taking 200 times more memory than cpp solution. Memory is mainly taken by dp array(you can take a quick view of the solutions). So my query is if an array is declared in java with new, will the memory be free after it's scope? Or for multiple test cases if in each test case array is declared with new, will the memory be free after each test case? And why it is happening for c++ and java solutions? I used System.gc() but it did not lessened the memory usage.

Tags #java, #memory

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English F__ 2019-07-09 19:11:22 668 Initial revision (published)