VirtualBox

Changeset 2754 in kBuild for trunk/src/kmk/commands.c


Ignore:
Timestamp:
Jan 23, 2015 11:00:41 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.

File:
1 edited

Legend:

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

    r2753 r2754  
    633633
    634634
    635 #ifdef KMK
     635#ifdef CONFIG_WITH_MEMORY_OPTIMIZATIONS
    636636/* This is for saving memory in func_commands. */
    637637void
    638638free_chopped_commands (struct commands *cmds)
    639639{
    640   if (cmds && cmds->command_lines != 0)
     640  if (   cmds
     641      && cmds->command_lines != 0
     642      && cmds->refs == 0)
    641643    {
    642644      unsigned idx = cmds->ncommand_lines;
     
    645647      free (cmds->command_lines);
    646648      free (cmds->lines_flags);
    647       cmds->command_lines = NULL;
    648       cmds->lines_flags = NULL;
    649     }
    650 }
    651 
    652 
    653 #endif /* CONFIG_WITH_COMMANDS_FUNC */
     649      cmds->command_lines = 0;
     650      cmds->lines_flags = 0;
     651      cmds->ncommand_lines = 0;
     652    }
     653}
     654
     655
     656#endif /* CONFIG_WITH_MEMORY_OPTIMIZATIONS */
    654657/* Execute the commands to remake FILE.  If they are currently executing,
    655658   return or have already finished executing, just return.  Otherwise,
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