# Flash leaving behind npviewer.bin 'stuff'.



## dralex999 (Jul 9, 2010)

I'm having a problem with flash leaving behind npviewer.bin 'things'... It tends to slow down my browsing and increases my memory usage. 

I need to know why it isn't cleaned up after the web page dies and how I can modify my browser, Firefox 3.5.10,  to automatically kill them...  ps -ax shows many occurances of npviewer.bin . And, um, I don't like that.

Even though a killall npviewer.bin works to get rid of them and thus improves my surfing speed I'd like to know how to rid myself of this little problem permanently.

Anyone ?


----------



## Oxyd (Jul 9, 2010)

I don't think there's a fix for that. Flash is simply buggy on FreeBSD. It is not that long ago when there still was no native Flash for FBSD.

I simply use FlashBlock for Firefox, so that FF doesn't try to launch Flash for every stupid Flash-based banner, and run pkill npviewer.bin every now and then. (Or when Firefox freezes.)


----------



## vermaden (Jul 9, 2010)

@dralex999

I do not use Flash enabled browser for all time browsing (Opera) and when I want to see a site with Flash, I launch Firefox with Flash enabled, and after I have seen what I wanted, I *kill(1)* both *npviewer.bin* and *firefox* processes.


----------



## SirDice (Jul 9, 2010)

`$ pkill npviewer` does the trick for me.

NB try not to use killall. If you're ever on Solaris killall does something completely different. It really kills _all_ processes, including init.


----------



## DutchDaemon (Jul 9, 2010)

I have this in my user's crontab:


```
*/5 * * * *	/home/myuser/flashkill > /dev/null
```

This is the script:


```
#!/bin/sh

flashcount=$(/bin/pgrep npviewer.bin | /usr/bin/wc -l)

if [ $flashcount = 1 ]
then
/usr/bin/killall npviewer.bin
fi
```

See http://forums.freebsd.org/showthread.php?p=67155#post67155 for rationale.

Works like a charm. Never looked back. Don't use it on Solaris


----------



## ScopeDog (Jul 31, 2010)

*pkill npviewer.bin when core dumps*

Thanks for the script DutchDaemon, but it doesn't always kill all unused npviewer.bin.
Especially when I switch flash videos from next to next, some processes remain.

So, I tried 

npviewer_monitor.sh

```
#!/bin/sh

corefile=${HOME}/npviewer.bin.core
intervaltime=1

while getopts p:s: option
do
    case "${option}" in
    p)
        parentpid=$OPTARG
        ;;
    s)
        intervaltime=$OPTARG
        ;;
    esac
done
shift $(($OPTIND - 1))

while :
do
    procstat "${parentpid}" > /dev/null 2>&1 || 
        break

    if [ -f "${corefile}" ]
    then
        pkill npviewer.bin
        rm "${corefile}"
    fi

    sleep "${intervaltime}"
done
```

which I picked up at http://gihyo.jp/admin/clip/01/fdt/200810/10, and use it as

`% daemon npviewer_monitor.sh -p $$`

It pkills npviewer.bin only when npviewer.bin.core exists and I put in my ~/.xsession.
(Also, I recommend not to start it on xterm etc, because it automatically terminates when its parent process dies.)
So far, it works well.


----------



## DutchDaemon (Jul 31, 2010)

Well, it hasn't failed me once since I started using it, and I don't have coredumps. Probably a slightly different setup. Whatever works for you is fine, of course.


----------

