Sunday, 23 September 2012

windows audiodg.exe memory leak

Windows7 still have a memory leak in audiodg.exe. Unfortunately I have discovered 4 month and a 4GB memory expansion late. You can solve it restarting Windows Audio service from time to time. 

I am a linux person but my computer was too new for linux so I ended with Windows  7 professional (even for windows I needed to install a lot of samsung's drivers and still are things that does not work properly). I usually does not shut down my laptop for months (suspend to ram works OK). But with this computer I needed to restart it once a week. When it had only 4GB it was getting quickly out of memory and windows, in its big desire to be helpful in its own ways, was closing programs at will with a polite notice ('sorry your computer has low memory I am going to close some programs') but without actually allowing you to decide. I bought another 4GB memory card, and then it takes 10 days before reaching to 31GB of virtual memory plus the 8GB of real memory and start to complain. 

I thought that this was due to my abuse of firefox tabs (usually 150-200 opened tabs) and the cache problem, plus a lot of other programs in use like  thunderbird, a linux virtual machine with 2GB, word, Xmind, excel, R....

I have seen several times one process with a lot of memory but always left aside (audiodg.exe). Finally today with all 31GB  virtual memory full and some windows warnings, closed firefox and chrome and I did not see any relevant change in the memory consumed, still 29GB after 1 hour. Looking at the Processes I saw that audiodg.exe had 25GB virtual memory allocated and 2GB real memory in use!!!!

A quick google search  shows that since 2009 is well known that audiodg.exe has a memory leak and there is a hot-fix for it (unfortunately people say that it does not work with windows 7). Some folks solved the problem restarting the audio server. I went to adminitrative_tools/componet_services and searched for audiodg. It was not there but there was a windows audio service. I restarted it and then the real memory used went from 8 to 3GB and the virtual memory from 29 to 4GB!!!!!!!!!!!

My computers just after restarting Windows Audio

Sunday, 16 September 2012

VCFtools 0.1.9 perl does not work with perl 5.14 or newer. use the VCFtools svn or this patch.

Error: bare qw() in a for loop: for $x qw() {} # deprecated. It needs to be surrounded by parents. . See my previous blog entry about this feature.

$  diff 
<         for my $key (qw(fmtA fmtG infoA infoG)) { if ( !exists($$out{$key}) ) { $$out{$key}=[] } }
>         for my $key qw(fmtA fmtG infoA infoG) { if ( !exists($$out{$key}) ) { $$out{$key}=[] } }
Now all tests work OK. [upate] the svn version 779 of is fixed
for my $key (qw(fmtA fmtG infoA infoG)) { if ( !exists($$out{$key}) ) { $$out{$key}=[] } }

perl 5.14 and up will break some of well known programs! Think twice (test thrice) before use it!

Seems that at some point someone thought that a qw() in a for loop should be surrounded by parents (qw()).
Lines like
$  perl -e 'foreach $x qw(1 2 3){print $x}'
Use of qw(...) as parentheses is deprecated at -e line 1.
are not permitted any longer. People has revealed against this and patches were proposed, but perl 5.16 still does not permit it. Some people say that this was a 'feature' of the parser not an intended behaviour (see comments in Reini's post).
In my case I switched to perl 5.14 and VCFtools was not working any more. At least I discovered it testing the test suit. 20 test failed all with the same error:
not ok 30 - Testing vcf-consensus .. perl -I../perl/ -MVcf ../perl/vcf-consensus  consensus.vcf.gz < consensus.fa
#   Failed test 'Testing vcf-consensus .. perl -I../perl/ -MVcf ../perl/vcf-consensus  consensus.vcf.gz < consensus.fa'
#   at test.t line 418.
#     Structures begin differing at:
#          $got->[0] = 'Use of qw(...) as parentheses is deprecated at ../perl// line 1622.
#     '
#     $expected->[0] = '>1:1-500
I am lucky to be using perlbrew so I can change quickly from one version of perl to another (not so lucky that I need to reinstall a lot of CPAN modules.)

Test::Most not automatically installed with cpanm. Some inner dependencies failed

After installing the the CVFtools, I went to test the perl scripts with
perl vcftools/perl/test.t
But failed becuase I needed Test::More. I tried to install it but failed:
$  cpanm
--> Working on Test::Most
Fetching ... OK
Configuring Test-Most-0.31 ... OK
==> Found dependencies: Exception::Class
--> Working on Exception::Class
Fetching ... OK
Configuring Exception-Class-1.33 ... OK
Building and testing Exception-Class-1.33 ... FAIL
! Installing Exception::Class failed. See /home/pmg/.cpanm/build.log for details.
! Bailing out the installation for Test-Most-0.31. Retry with --prompt or --force.
Looking at .cpanm/build.log I saw that Class/Data/ was missing. The dependency was not automatically picked and installed so I installed by hand. Then tried again Test::Most, and again Exception-Class was failing. This time needed Devel::StackTrace. I installed this one also by hand and now all went OK.
cpanm Devel::StackTrace
cpanm Test::More
These missing dependencies are not uncommon in CPAN but are a bit annoying, mainly if your cpanm install action becomes large and the failed module is at the beginning and your last line says, 11 packages installed (all dependencies of your wanted package, but the wanted one is not installed). In situations like this, is easy to skip that your modules was not installed.