Skip to content

Memory leak, especially during sleep #9

@DavidBoike

Description

@DavidBoike

I think FunctionFlip still has a memory leak that is most prominent when the Mac is sleeping.

I kept noticing FunctionFlip taking inordinate amounts of memory, upwards of 1 gig. Stopping and restarting it from the prefs pane seemed to knock it back down to a very reasonable 7 MB or so.

I wrote a bash script to monitor the memory usage over time:

#! /bin/bash

while [ TRUE ]; do
    output="$(top -l 1 -o MEM -stats pid,command,cpu,time,mem,rprvt,purg,vsize,kprvt,kshrd,faults,cmprs | grep FunctionFlip)"
    echo "$(date +%Y-%m-%dT%H:%M:%S) $output" >> FunctionFlip.log
sleep 60

Which results in a log like:

2018-05-16T08:37:59 34254  FunctionFlip     0.0  00:00.18 7504K+ N/A   0B     N/A   N/A   N/A   9283+      0B    
2018-05-16T08:39:00 34254  FunctionFlip     0.0  00:00.20 7468K+ N/A   0B     N/A   N/A   N/A   9292+      0B 

After sleeping my Mac for a little over an hour to go to lunch, I took a look at Activity Monitor:

image

So then looked at the log. It looks like what Activity Monitor reports as "Memory" is actually the sum of the mem (internal memory size) and cmprs (bytes of compressed data belonging to process) values. Most of the rest of the data turned out to be useless, but I graphed those two values in addition to page faults:

image

The huge ramp-up in page faults (dark blue) and total memory (royal blue, really driven by compressed memory in red) occurred at the same time I put my Mac to sleep and leveled at the point where they level off.

Hopefully this investigation helps somehow? I'd be thrilled to donate some beer money if this can be fixed, as this is a tool I use every single day.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions