Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

Java: memory issue

Правка en1, от 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.

Теги #java, #memory

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский F__ 2019-07-09 19:11:22 668 Initial revision (published)