{"id":255425,"date":"2015-04-17T10:49:02","date_gmt":"2015-04-17T06:49:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=255425"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=255425","title":{"rendered":"\u041d\u043e\u0432\u044b\u0439 \u0441\u0443\u043f\u0435\u0440\u0431\u043b\u0438\u0446 \u043f\u043e Java-\u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0443"},"content":{"rendered":"<p>     \t\u0418\u0442\u0430\u043a, \u0432\u0447\u0435\u0440\u0430 \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/255869\/\">\u043f\u043e\u0438\u0433\u0440\u0430\u043b\u0438<\/a> \u0432 \u0434\u0436\u0430\u0432\u043e\u0432\u0441\u043a\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u00ab\u0418\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u0430\u0437\u0438\u043d\u043e \u043f\u0440\u043e\u0442\u0438\u0432 \u0437\u043d\u0430\u0442\u043e\u043a\u043e\u0432\u00bb, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043f\u0440\u0438 \u0432\u0441\u0435\u043c \u0443\u0432\u0430\u0436\u0435\u043d\u0438\u0438 \u043a \u0445\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0430\u043c, \u0442\u0435\u043b\u0435\u0437\u0440\u0438\u0442\u0435\u043b\u0438 \u0432\u044b\u0438\u0433\u0440\u0430\u043b\u0438! \u0415\u0441\u043b\u0438 \u0436\u0435 \u044f \u0432\u0434\u0440\u0443\u0433 \u0443\u043f\u0443\u0441\u0442\u0438\u043b \u0437\u043d\u0430\u0442\u043e\u043a\u043e\u0432, \u0440\u0435\u0448\u0438\u0432\u0448\u0438\u0445 \u0432\u0447\u0435\u0440\u0430 \u0445\u043e\u0442\u044f \u0431\u044b \u0442\u0440\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435 \u0432 \u043b\u0438\u0447\u043a\u0443, \u0438 \u043d\u0430\u0433\u0440\u0430\u0434\u0430 \u043d\u0430\u0439\u0434\u0435\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0433\u0435\u0440\u043e\u044f!<\/p>\n<p>  \u0412\u0447\u0435\u0440\u0430 \u043d\u0430\u0441 \u0441 \u0442\u0435\u043b\u0435\u0437\u0440\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043e\u0431\u0432\u0438\u043d\u0438\u043b\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0432\u0447\u0435\u0440\u0430\u0448\u043d\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0431\u044b\u043b\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 Java \u0432\u0435\u0441\u044c\u043c\u0430 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e. \u041c\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u044d\u0442\u043e \u043e\u0431\u0432\u0438\u043d\u0435\u043d\u0438\u0435, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0443 \u043d\u0430\u0441 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u0439 Java! \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u043f\u0440\u0438\u043d\u0433\u043e\u0432, \u044d\u043a\u0441\u044d\u043c\u044d\u043b\u0435\u0439 \u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0445 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0430!<\/p>\n<p>  \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u2014 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0447\u0435\u0440\u0430\u0448\u043d\u0438\u0439 \u0440\u0430\u0443\u043d\u0434 \u0438 \u0441\u0443\u043f\u0435\u0440\u0431\u043b\u0438\u0446! \u041f\u0440\u043e\u0442\u0438\u0432 \u0437\u043d\u0430\u0442\u043e\u043a\u043e\u0432 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0438\u0433\u0440\u0430\u0435\u0442 \u0442\u0435\u043b\u0435\u0437\u0440\u0438\u0442\u0435\u043b\u044c \u0438\u0437 \u041f\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433\u0430 <b>\u0410\u043d\u0434\u0440\u0435\u0439  <a href=\"http:\/\/habrahabr.ru\/users\/apangin\/\" class=\"user_link\">apangin<\/a> \u041f\u0430\u043d\u044c\u0433\u0438\u043d<\/b>.<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/48e\/b31\/3d4\/48eb313d4f9140a2a314017840b42a49.jpg\"\/><\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  \u041d\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 <b>\u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 <a href=\"http:\/\/habrahabr.ru\/post\/255869\/\">\u0432\u0447\u0435\u0440\u0430\u0448\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u0447\u0438<\/a><\/b>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u043e\u0442 \u041d\u0438\u043a\u043e\u043b\u0430\u044f \u0413\u0430\u0440\u0431\u0443\u0437\u043e\u0432\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<blockquote><p><b>\u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 AJC \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c?<\/b><br \/>  \u0415\u0441\u043b\u0438 \u0434\u0430 \u2014 \u0442\u043e \u0447\u0442\u043e \u043e\u043d \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438?<\/p>\n<pre><code class=\"java\">public aspect QuizAspect {     public static int count(int i) {         return i++;     }      before (int n) : execution(public int QuizAspect.count(int))              && args(n) && if(QuizAspect.count(1)&gt;1) {         System.out.println(&quot;QuizAspect &quot; + n);     } } <\/code><\/pre>\n<\/blockquote>\n<p>  <b>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442.<\/b> \u0421\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u043d\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430 Quiz.count \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u0442 \u043a StackOverflowError \u043e\u0448\u0438\u0431\u043a\u0435!<\/p>\n<blockquote><p>\u041c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 if() \u043d\u0430\u0447\u043d\u0435\u0442 \u0432\u044b\u043f\u043e\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043a\u043e\u0434\u0430, \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a.<br \/>  (\u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u0443\u0442\u0430\u0442\u044c \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0441 \u043c\u0435\u0442\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c)<br \/>  \u0410\u0441\u043f\u0435\u043a\u0442 \u043b\u0438\u0448\u044c \u0432\u0441\u0442\u0440\u043e\u0438\u0442 \u043a\u043e\u0434 \u0441\u043e\u0432\u0435\u0442\u0430 \u0432\u043d\u0443\u0442\u0440\u044c \u043c\u0435\u0442\u043e\u0434\u0430 count, \u0434\u043e\u0431\u0430\u0432\u0438\u0442 <i>if()<\/i> \u043a \u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434\u0443.<\/p><\/blockquote>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0412\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043e\u0442 \u0412\u043b\u0430\u0434\u0438\u043c\u0438\u0440\u0430 \u0421\u0438\u0442\u043d\u0438\u043a\u043e\u0432\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<blockquote><p>\u0412 \u0447\u0451\u043c \u043f\u043e\u0434\u0432\u043e\u0445 \u0443\u0434\u0430\u043b\u044f\u0442\u044c Java-\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0442\u0430\u043a\u0438\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c? \u0423\u043a\u0430\u0436\u0438\u0442\u0435 3 \u043f\u0440\u0438\u0447\u0438\u043d\u044b, \u043f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f. (\u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438) \u2014 <\/p>\n<pre><code class=\"java\">Pattern.compile(&quot;\/\\\\*(?:[^*]|\\\\*[^\/])*\\\\*\/&quot;) <\/code><\/pre>\n<p>  <b>\u041e\u0442\u0432\u0435\u0442<\/b>  <\/p>\n<ol>\n<li>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0434\u0436\u0430\u0432\u043e\u0432\u0441\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u0430 \u0432 \u043d\u0435\u0439 \u044f\u043a\u043e\u0431\u044b \u043a\u043e\u043c\u0435\u043d\u0442 \u2014 \u0442\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0435 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0438 \u0441\u043b\u044d\u0448, \u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442<\/li>\n<li>\u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0411\u0443\u0434\u0435\u0442 StackOverflowError, \u0442.\u043a. java regexp\u2019\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 backtracking.<\/li>\n<\/ol>\n<p>  \u041f\u043e\u0444\u0438\u043a\u0441\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438:  <\/p>\n<ul>\n<li>Possessive quantifier:\n<pre><code class=\"java\">Pattern.compile(&quot;\/\\\\*(?:[^*]|\\\\*[^\/])*+\\\\*\/&quot;)<\/code><\/pre>\n<\/li>\n<li>Independent group:\n<pre><code class=\"java\">Pattern.compile(&quot;\/\\\\*(?&gt;,[^*]|\\\\*[^\/])*\\\\*\/&quot;)<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/blockquote>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043f\u0440\u0438\u043d\u0433\u043e\u0432\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u044b \u043e\u0442 \u041d\u0438\u043a\u043e\u043b\u0430\u0439 \u0410\u043b\u0438\u043c\u0435\u043d\u043a\u043e\u0432\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<blockquote><p>\u0415\u0441\u0442\u044c 2 Spring \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430:<\/p>\n<p>  1. a.xml \u0441 \u0431\u0438\u043d\u043e\u043c<\/p>\n<pre><code class=\"xml\">&lt;util:list id=&quot;myList&quot;&gt;             &lt;value&gt;3&lt;\/value&gt;             &lt;value&gt;4&lt;\/value&gt;     &lt;\/util:list&gt;<\/code><\/pre>\n<p>  2. b.xml \u0441 \u0431\u0438\u043d\u043e\u043c<\/p>\n<pre><code class=\"xml\">&lt;util:list id=&quot;myList&quot;&gt;     &lt;value&gt;6&lt;\/value&gt; &lt;\/util:list&gt; <\/code><\/pre>\n<p>  \u0427\u0442\u043e \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0435\u0442 \u0442\u0430\u043a\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"java\">System.out.println(new ClassPathXmlApplicationContext(&quot;a.xml&quot;, &quot;b.xml&quot;).getBean(&quot;myList&quot;)); <\/code><\/pre>\n<p>  \u0418 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443, \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u044f \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u043e\u0434\u0430?<\/p>\n<p>  <b>\u041e\u0442\u0432\u0435\u0442<\/b><br \/>  \u0412\u044b\u0432\u0435\u0434\u0435\u0442 <b>6<\/b>, \u0430 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 <i>allowBeanDefinitionOverriding<\/i> \u0443 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u0432 false.   <\/p><\/blockquote>\n<p>  <\/div>\n<\/div>\n<p>  \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0430\u043c\u0430\u044f <b>\u0445\u0430\u0440\u0434\u043a\u043e\u0440\u043d\u0430\u044f<\/b> \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u0447\u0435\u0440\u0430\u0448\u043d\u0435\u0433\u043e \u0434\u043d\u044f, \u043f\u043e \u043c\u043d\u0435\u043d\u0438\u044e \u043f\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442\u0430, \u043f\u0440\u0435\u043c\u044c\u0435\u0440\u0430 \u0438 \u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430 \u043e\u0431\u043e\u0440\u043e\u043d\u044b \u044d\u043b\u0438\u0442\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u043b\u0443\u0431\u0430.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">OOM \u043e\u0442 \u041d\u0438\u043a\u0438\u0442\u044b \u0421\u0430\u043b\u044c\u043d\u0438\u043a\u043e\u0432\u0430-\u0422\u0430\u0440\u043d\u043e\u0432\u0441\u043a\u043e\u0433\u043e<\/b><\/p>\n<div class=\"spoiler_text\">\n<blockquote><p>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b 2 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u041a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0430\u043b\u043b\u043e\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0445\u0438\u043f\u0430. \u041d\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u0442 java.lang.OutOfMemoryError, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u0442. \u041f\u043e\u0447\u0435\u043c\u0443?<\/p>\n<pre><code class=\"java\">public class OOM1 {     private static final int SIZE = (int) (Runtime.getRuntime().maxMemory() * 0.55);      public static void main(String[] args) {         {             byte[] bytes = new byte[SIZE];             System.out.println(bytes.length);         }          byte[] bytes1 = new byte[SIZE];         System.out.println(bytes1.length);          System.out.println(&quot;I allocated memory successfully&quot;);     } }  public class OOM2 {     private static final int SIZE = (int) (Runtime.getRuntime().maxMemory() * 0.35);      public static void main(String[] args) {         {             byte[] bytes = new byte[SIZE];             System.out.println(bytes.length);         }          byte[] bytes1 = new byte[SIZE];         System.out.println(bytes1.length);          byte[] bytes2 = new byte[SIZE];         System.out.println(bytes2.length);      System.out.println(&quot;I allocated memory successfully&quot;);     } } <\/code><\/pre>\n<p>  <b>\u041e\u0442\u0432\u0435\u0442<\/b><br \/>  \u0412 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 javac \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f bytes \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043a\u043b\u0430\u0434\u0435\u043c \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e bytes1, \u0437\u0430\u0439\u043c\u0435\u0442 \u0442\u043e\u0442 \u0436\u0435 \u0441\u043b\u043e\u0442, \u0447\u0442\u043e \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f bytes. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u043d\u0438\u044f bytes1 &lt; \u2014 new bytes[SIZE] \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b\u043b\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 bytes \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0438 GC \u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c OOM2 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 70% \u043e\u0442 \u0445\u0438\u043f\u0430, \u0430 \u043d\u0435 105%.  <\/p><\/blockquote>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0413\u0440\u0443\u0432\u0438 \u043e\u0442 \u0411\u0430\u0440\u0443\u0445\u0430 \u0421\u0430\u0434\u043e\u0433\u0443\u0440\u0441\u043a\u043e\u0433\u043e \u0438 \u0421\u043f\u0440\u0438\u043d\u0433 \u043e\u0442 \u0416\u0435\u043d\u0438 \u0411\u043e\u0440\u0438\u0441\u043e\u0432\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\u0410 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u0441 \u0436\u0434\u0435\u0442 \u043e\u0431\u043b\u043e\u043c.  <a href=\"http:\/\/habrahabr.ru\/users\/jbaruch\/\" class=\"user_link\">jbaruch<\/a> \u0438  <a href=\"http:\/\/habrahabr.ru\/users\/evgenyborisov\/\" class=\"user_link\">EvgenyBorisov<\/a> \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b\u0438 \u043c\u0435\u043d\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0438\u043d\u0442\u0440\u0438\u0433\u0443 \u0438 \u043d\u0435 \u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0438\u0445 \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043e JPoint. \u0421\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u0438 \u043d\u0430 \u0438\u0445 <a href=\"http:\/\/javapoint.ru\/talks\/\">\u0434\u043e\u043a\u043b\u0430\u0434\u044b<\/a>. <\/p>\n<p>  \u0416\u0435\u043b\u0430\u044e\u0449\u0438\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b \u2014 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043c \u0432 \u043b\u0438\u0447\u043a\u0443. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043d\u0438 \u0441\u0436\u0430\u043b\u044f\u0442\u0441\u044f \u043d\u0430\u0434 \u0432\u0430\u043c\u0438!  <\/div>\n<\/div>\n<p>  <b>\u0421\u0443\u043f\u0435\u0440\u0431\u043b\u0438\u0446 \u043e\u0442 \u0410\u043d\u0434\u0440\u0435\u044f \u041f\u0430\u043d\u044c\u0433\u0438\u043d\u0430<\/b><br \/>  \u0412\u043e\u0442 \u0438 \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0433\u043e \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0430! \u0417\u043d\u0430\u0442\u043e\u043a\u0438 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044e\u0442 \u0433\u043b\u0430\u0437\u0430 \u043a \u043d\u0435\u0431\u0443 \u0438 \u043d\u0430 \u0438\u0445 \u044d\u043a\u0440\u0430\u043d\u0430\u0445 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u043b\u044b\u0431\u0430\u044e\u0449\u0438\u0439\u0441\u044f  <a href=\"http:\/\/habrahabr.ru\/users\/apangin\/\" class=\"user_link\">apangin<\/a>. \u041e\u043d \u043a\u0430\u0433\u0431\u044d \u043c\u0430\u0448\u0438\u0442 \u0432\u0441\u0435\u043c \u0437\u043d\u0430\u0442\u043e\u043a\u0430\u043c\u0438 \u0438 \u043a\u0438\u0434\u0430\u0435\u0442 \u0438\u043c \u0442\u044b\u0441\u044f\u0447\u0438 \u0432\u043e\u0437\u0434\u0443\u0448\u043d\u044b\u0445 \u043f\u043e\u0446\u0435\u043b\u0443\u0435\u0432.<\/p>\n<p>  <b>\u0412\u043e\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0432\u044b\u0439<\/b>  <\/p>\n<blockquote><p>\u0427\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c? \u041a\u0430\u043a \u0435\u0433\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c?  <\/p>\n<pre><code class=\"java\">     public static double[] getRandomVector(int size) {         double[] vector = new double[size];         Arrays.parallelSetAll(vector, i -&gt; Math.random());         return vector;     } <\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <b>\u0412\u043e\u043f\u0440\u043e\u0441 \u0432\u0442\u043e\u0440\u043e\u0439<\/b>  <\/p>\n<blockquote><p>\u041a\u0430\u043a \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0447\u0442\u043e \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e?  <\/p>\n<pre><code class=\"java\"> public class Modifiers {     static final Inner inner = new Inner();       static class Inner {         int x = 1;           int getX1() { return x; }         int getX2() { return getX1(); }         int getX3() { return getX2(); }         int getX4() { return getX3(); }         int getX5() { return getX4(); }         int getX6() { return getX5(); }         int getX7() { return getX6(); }         int getX8() { return getX7(); }         int getX9() { return getX8(); }           private int getPrivate() { return getX9(); }         public int getPublic()   { return getX9(); }     }       @Benchmark     public int testGetPrivate() {         return inner.getPrivate();     }       @Benchmark     public int testGetPublic() {         return inner.getPublic();     } } <\/code><\/pre>\n<p>  <\/p><\/blockquote>\n<p>  <b>\u0412\u043e\u043f\u0440\u043e\u0441 \u0442\u0440\u0435\u0442\u0438\u0439<\/b>  <\/p>\n<blockquote><p>\u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0432 Java \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 (\u0438\u043c\u0435\u043d\u043d\u043e \u043a\u043b\u0430\u0441\u0441, \u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441) \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0430, \u0434\u0430\u0436\u0435 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u043e\u0433\u043e?  <\/p><\/blockquote>\n<p>  \u0422\u0430\u043a\u0438\u0435 \u0434\u0435\u043b\u0430!<\/p>\n<p>  \u0412\u0430\u0448\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043f\u0438\u0448\u0438\u0442\u0435 \u043d\u0438\u0436\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 <b>\u043f\u043e\u0434 \u0441\u043f\u043e\u0439\u043b\u0435\u0440\u043e\u043c<\/b>. \u0423 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c 12 \u0447\u0430\u0441\u043e\u0432. \u0420\u0435\u0448\u0438\u0432\u0448\u0438\u0435 \u0432\u0441\u0435 \u0442\u0440\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u0438\u0437 \u043e\u0442 \u0410\u043d\u0434\u0440\u0435\u044f, \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u041e\u0434\u043d\u043e\u043a\u043b\u0430\u0441\u0441\u043d\u0438\u043a\u0438 \u0438 JUG.ru.<\/p>\n<p>  \u041e\u0442\u0432\u0435\u0442\u044b \u2014 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e \u043d\u0430 \u0445\u0430\u0431\u0440\u0435, \u043d\u043e \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 JPoint. <\/p>\n<p>  \u0423\u0434\u0430\u0447\u0438!     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/255951\/\"> http:\/\/habrahabr.ru\/post\/255951\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t\u0418\u0442\u0430\u043a, \u0432\u0447\u0435\u0440\u0430 \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/255869\/\">\u043f\u043e\u0438\u0433\u0440\u0430\u043b\u0438<\/a> \u0432 \u0434\u0436\u0430\u0432\u043e\u0432\u0441\u043a\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u00ab\u0418\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u0430\u0437\u0438\u043d\u043e \u043f\u0440\u043e\u0442\u0438\u0432 \u0437\u043d\u0430\u0442\u043e\u043a\u043e\u0432\u00bb, \u0438 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u043f\u0440\u0438 \u0432\u0441\u0435\u043c \u0443\u0432\u0430\u0436\u0435\u043d\u0438\u0438 \u043a \u0445\u0430\u0431\u0440\u043e\u0432\u0447\u0430\u043d\u0430\u043c, \u0442\u0435\u043b\u0435\u0437\u0440\u0438\u0442\u0435\u043b\u0438 \u0432\u044b\u0438\u0433\u0440\u0430\u043b\u0438! \u0415\u0441\u043b\u0438 \u0436\u0435 \u044f \u0432\u0434\u0440\u0443\u0433 \u0443\u043f\u0443\u0441\u0442\u0438\u043b \u0437\u043d\u0430\u0442\u043e\u043a\u043e\u0432, \u0440\u0435\u0448\u0438\u0432\u0448\u0438\u0445 \u0432\u0447\u0435\u0440\u0430 \u0445\u043e\u0442\u044f \u0431\u044b \u0442\u0440\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u2014 \u043f\u0438\u0448\u0438\u0442\u0435 \u043c\u043d\u0435 \u0432 \u043b\u0438\u0447\u043a\u0443, \u0438 \u043d\u0430\u0433\u0440\u0430\u0434\u0430 \u043d\u0430\u0439\u0434\u0435\u0442 \u0441\u0432\u043e\u0435\u0433\u043e \u0433\u0435\u0440\u043e\u044f!<\/p>\n<p>  \u0412\u0447\u0435\u0440\u0430 \u043d\u0430\u0441 \u0441 \u0442\u0435\u043b\u0435\u0437\u0440\u0438\u0442\u0435\u043b\u044f\u043c\u0438 \u043e\u0431\u0432\u0438\u043d\u0438\u043b\u0438 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0432\u0447\u0435\u0440\u0430\u0448\u043d\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0431\u044b\u043b\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 Java \u0432\u0435\u0441\u044c\u043c\u0430 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e. \u041c\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u044d\u0442\u043e \u043e\u0431\u0432\u0438\u043d\u0435\u043d\u0438\u0435, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0443 \u043d\u0430\u0441 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430 \u0447\u0438\u0441\u0442\u043e\u0439 Java! \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0441\u043f\u0440\u0438\u043d\u0433\u043e\u0432, \u044d\u043a\u0441\u044d\u043c\u044d\u043b\u0435\u0439 \u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0438\u0441\u0442\u0438\u043d\u043d\u044b\u0445 \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0445\u0430\u0440\u0434\u043a\u043e\u0440\u0430!<\/p>\n<p>  \u041f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u2014 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0432\u0447\u0435\u0440\u0430\u0448\u043d\u0438\u0439 \u0440\u0430\u0443\u043d\u0434 \u0438 \u0441\u0443\u043f\u0435\u0440\u0431\u043b\u0438\u0446! \u041f\u0440\u043e\u0442\u0438\u0432 \u0437\u043d\u0430\u0442\u043e\u043a\u043e\u0432 \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u0438\u0433\u0440\u0430\u0435\u0442 \u0442\u0435\u043b\u0435\u0437\u0440\u0438\u0442\u0435\u043b\u044c \u0438\u0437 \u041f\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433\u0430 <b>\u0410\u043d\u0434\u0440\u0435\u0439  <a href=\"http:\/\/habrahabr.ru\/users\/apangin\/\" class=\"user_link\">apangin<\/a> \u041f\u0430\u043d\u044c\u0433\u0438\u043d<\/b>.<\/p>\n<p>  <img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/48e\/b31\/3d4\/48eb313d4f9140a2a314017840b42a49.jpg\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-255425","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255425","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=255425"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/255425\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}