Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-834

Velocity consumes too much heap memory [1]

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.7
    • 2.0
    • Engine
    • all

    Description

      We have a server product that uses Velocity to render Web content. It turns out that most long-lived heap objects are hold by Velocity's RuntimeInstance. In some cases more than 15% of these objects are string duplicates of language related tokens (#set(, #if,...), or common literals (SPACE, parens,...).

      These common tokens should be mapped by the parser to single instances, or avoided by the grammar where possible.

      Some of the duplicates are related to VELOCITY-833.

      Example: A RuntimeInstance with 500 MB retained heap size references among others the following string instances which sum up to about 87 MB.

      String Value;Objects;Shallow Heap;Avg. Retained Size;Retained Heap;
      ;329906;10556992;55;18474568;
      );313875;10044000;55;17576976;
      (;207053;6625696;56;11594968;
      ,;141815;4538080;55;7925992;
      =;89425;2861600;55;5007464;
      #set(;44074;1410368;64;2820736;
      #if;43801;1401632;56;2452856;
      ==;38521;1232672;56;2157176;
      #

      {end};29169;933408;64;1866816;
      false;24454;782528;63;1564288;
      #{else};17231;551392;64;1102784;
      )\u000d\u000a;15344;491008;56;859264;
      #elseif;14653;468896;64;937792;
      ;13928;445696;33;464568;
      true;13511;432352;55;755320;
      };11772;376704;56;659232;
      #end\u000d\u000a;11479;367328;64;734656;
      """";11032;353024;55;607712;
      $(;10853;347296;56;607768;
      0;9834;314688;45;451608;
      #end;9404;300928;56;526624;
      !;8695;278240;56;486920;
      ${;8420;269440;56;471520;
      """""";8293;265376;32;265496;
      1;8096;259072;51;413080
      ||;6354;203328;56;355824;
      #else;6319;202208;64;404416;
      macro;5639;180448;32;180480;
      #macro;5638;180416;32;180416;
      -1;5079;162528;40;204504;
      '';4457;142624;32;142648;
      &&;4395;140640;56;246120;
      0 ;4120;131840;56;230720;
      """>";4108;131456;56;230048;
      \u000d\u000a;3788;121216;56;212128;
      >;3451;110432;56;193256;
      -1 ;3327;106464;56;186312;
      ';3145;100640;55;175880;
      $!{;2893;92576;56;162008;
      !=;2835;90720;56;158760;
      (';2238;71616;56;125328;
      !'$#\;2223;71136;64;142272;
      """0""";2174;69568;32;69568;
      &;2121;67872;55;118536;
      ];2007;64224;56;112392;
      '0';1946;62272;32;62272;
      """-1""";1704;54528;32;54552;
      foreach;1678;53696;32;53728;
      #foreach;1677;53664;32;53664;
      1 ;1670;53440;56;93520;
      [;1631;52192;56;91336;
      '-1';1624;51968;32;51968;
      \u0009#set(;1375;44000;64;88000;
      "');";1257;40224;56;70392;
      4;1153;36896;55;63920;
      "#""";1075;34400;56;60200;
      """;\u000d\u000a";1070;34240;56;59920;
      2;1065;34080;51;54936;
      +;1050;33600;56;58800;
      '1';1034;33088;32;33088;
      -;1025;32800;55;57304;
      #else\u000d\u000a;1024;32768;64;65536;
      \;997;31904;55;55784;
      #{elseif};976;31232;72;70272;
      \u000d;933;29856;56;52248;
      #{end}

      \u000d\u000a;922;29504;64;59008;
      ;920;29440;64;58880;
      /;920;29440;55;51424;
      .;892;28544;44;40136;
      ',';885;28320;38;34200;
      \u0009\u0009 #set(;792;25344;72;57024;
      ');770;24640;56;43120;
      \u0009\u0009#set(;716;22912;64;45824;
      5;680;21760;55;37432;
      :;670;21440;56;37520;
      )";668;21376;384;256512;
      ##;650;20800;56;36400;
      . ;610;19520;56;34160;
      8;509;16288;55;28336;

      1. ;494;15808;56;27664;
        <=;476;15232;56;26656;
        $.;471;15072;56;26376;
        ;442;14144;56;24752;
        ) \u000d\u000a;442;14144;56;24752;
        ;406;12992;56;22736;

      Note that strings with quotes are qouted according to the standard CSV rules.

      Attachments

        Issue Links

          Activity

            People

              cbrisson Claude Brisson
              veita Alexander Veit
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: