Блог пользователя F__

Автор F__, история, 5 лет назад, По-английски

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.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится