[apparmor] [PATCH] cleanup followpos
John Johansen
john.johansen at canonical.com
Fri Jul 9 10:24:10 BST 2010
On 07/08/2010 06:57 PM, Steve Beattie wrote:
> On Thu, Jul 08, 2010 at 06:06:56PM -0700, Steve Beattie wrote:
>> On Wed, Jul 07, 2010 at 11:14:33AM -0700, John Johansen wrote:
>>> On 07/07/2010 10:51 AM, John Johansen wrote:
>>>> When creating the dfa the sets firstpos, lastpos, and followpos are computed for
>>>> each expression tree node and then used as input to create the dfa states.
>>>>
>>>> Currently they are not being freed until the nodes are destroyed, but the information
>>>> is no longer needed once the dfa has been created. Cleaning them up early reduces
>>>> peak memory usage.
>>>>
>>> I would like to nominate this patch for 2.5.1 as it helps reduce memory usage
>>
>> ACK from me for both, please commit to trunk so I can pull onto the
>> 2.5.1 branch.
>
> Though putzing around with this patch applied under valgrind actually
> appears to cause more memory to be used over the lifetime of the
> process, roughly 150KB on ubuntu 10.04/amd64 against the shipped
> evince profile (168,126,893 bytes without patch, 168,277,737 with).
> However, more deallocations are done and the amount in use at exit is
> reduced. I still think this is okay.
>
Hrmm strange, I am unsure why more memory is being allocated, perhaps
something to do with resetting C++ templates twice? I can play with
this some more but from libmemusage this was a net win on peak usage.
I can see this causing more deallocations if clearing the set template
does some allocations which might be what you are seeing, with increased
total memory usage.
It really shouldn't be freeing anymore at exit though as we are calling
aare_delete_ruleset in parser_policy. This indicates to me a leak in
the reference counting of the nodes so that not all nodes are being
freed, but since I am in the middle of reworking this to get rid of
the reference counting its not worth chasing.
> (Is there a way to measure a high water mark of a process' memory
> usage?)
>
libmemusage
More information about the AppArmor
mailing list