VirtualBox

Changeset 2056 in kBuild for trunk/src/kmk/job.c


Ignore:
Timestamp:
Nov 4, 2008 3:25:19 AM (17 years ago)
Author:
bird
Message:

kmk: some MBs of memory during building by freeing up the chopped up command lines after we're done with them. (Code not perfect, but wtf., it saves me 7 MBs (out of 45), a bunch of faults and turns out to using less cpu time...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/job.c

    r2001 r2056  
    944944    }
    945945
     946#ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS
     947  /* Free the chopped command lines for simple targets when
     948     there are no more active references to them.  */
     949
     950  child->file->cmds->refs--;
     951  if (   !child->file->intermediate
     952      && !child->file->pat_variables
     953      && child->file->cmds->refs == 0)
     954    {
     955      struct commands *cmds = child->file->cmds;
     956      unsigned int i;
     957
     958      for (i = 0; i < cmds->ncommand_lines; ++i)
     959        {
     960          free (cmds->command_lines[i]);
     961          cmds->command_lines[i] = 0;
     962        }
     963      free (cmds->command_lines);
     964      cmds->command_lines = 0;
     965      free (cmds->lines_flags);
     966      cmds->lines_flags = 0;
     967      cmds->ncommand_lines = 0;
     968    }
     969#endif /* CONFIG_WITH_MEMORY_OPTIMIZATIONS */
     970
    946971  free (child);
    947972}
     
    16821707  /* Chop the commands up into lines if they aren't already.  */
    16831708  chop_commands (cmds);
     1709#ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS
     1710  cmds->refs++; /* retain the chopped lines.  */
     1711#endif
    16841712
    16851713  /* Expand the command lines and store the results in LINES.  */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette