VirtualBox

Changeset 2753 in kBuild for trunk/src


Ignore:
Timestamp:
Jan 23, 2015 9:46:30 PM (10 years ago)
Author:
bird
Message:

kmk: Save 20+ MB of memory for chopped receipt command lines by freeing them after we're done evaluating a target.

Location:
trunk/src/kmk
Files:
3 edited

Legend:

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

    r2664 r2753  
    633633
    634634
     635#ifdef KMK
     636/* This is for saving memory in func_commands. */
     637void
     638free_chopped_commands (struct commands *cmds)
     639{
     640  if (cmds && cmds->command_lines != 0)
     641    {
     642      unsigned idx = cmds->ncommand_lines;
     643      while (idx-- > 0)
     644        free (cmds->command_lines[idx]);
     645      free (cmds->command_lines);
     646      free (cmds->lines_flags);
     647      cmds->command_lines = NULL;
     648      cmds->lines_flags = NULL;
     649    }
     650}
     651
     652
     653#endif /* CONFIG_WITH_COMMANDS_FUNC */
    635654/* Execute the commands to remake FILE.  If they are currently executing,
    636655   return or have already finished executing, just return.  Otherwise,
  • trunk/src/kmk/commands.h

    r2594 r2753  
    5757void delete_child_targets (struct child *child);
    5858void chop_commands (struct commands *cmds);
     59#ifdef KMK
     60void free_chopped_commands (struct commands *cmd);
     61#endif
    5962#if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE)
    6063void set_file_variables (struct file *file, int called_early);
  • trunk/src/kmk/remake.c

    r2743 r2753  
    13291329    file->update_status = 0;
    13301330#endif
     1331
     1332#ifdef KMK
     1333    /* We're done with this command, so free the memory held by the chopped
     1334       command lines. Saves heap for the compilers & linkers. */
     1335    if (file->cmds && file->cmds->command_lines)
     1336      free_chopped_commands (file->cmds);
     1337#endif
    13311338}
    13321339
Note: See TracChangeset for help on using the changeset viewer.

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