in reply to Re^4: Memory Usage in Regex On Large Sequence
in thread Memory Usage in Regex On Large Sequence
You could check for $& and freinds having been used somewhere in a library using Devel::SawAmpersand.
However, I tried running the following minimal emulation of your code:
#! perl -slw use strict; use Carp; use threads; use threads::shared; $| = 1; our $N ||= 2; our $SIZE ||= 1e6; my $semaphore :shared = 0; my $running : shared = 0; 'abc' =~ m[b] and print "$`:$&:$'"; ## Use ampersand. my $bigString = 'ACTG' x $SIZE; for ( 1 .. $N ) { async { printf "Thread %s starting\n", threads->tid; ++$running; my $count = 0; while( $bigString =~ m[ACTG]g ) { #lock $semaphore; #print threads->tid, ' : ', pos( $bigString ); ++$count; } --$running; printf "Thread %s stopping ($count)\n", threads->tid; }; } Win32::Sleep 100 until $running; Win32::Sleep 100 while $running;
With and without the highlighted line and it doesn't cause a crash on my system even when running 100 threads and a 10e6 char sequence. It runs hugely more slowly, but that is expected.
The only thing I can see missing from my simplified version is Bio::SeqIO (Darn thing will never install here!). As a test, you could try substituting this crude Fasta sequence load code (taken from Re: Forking Multiple Regex's on a Single String (use threads))
## Crude fasta load--Expects 1 sequence per file open my $fh, '<', $path or croak "$path : $!\n"; <$fh>; ## discard header ( my $sequence = do{ local $/; <$fh> } ) =~ s[\s+][]g; close $fh;
and remove the dependancy upon that module and see what if any difference that makes.
Beyond that, you could try running my emulation above on your system and see if that also causes the Out of memory failure.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Memory Usage in Regex On Large Sequence
by bernanke01 (Beadle) on Sep 26, 2006 at 22:41 UTC | |
by BrowserUk (Patriarch) on Sep 26, 2006 at 23:08 UTC | |
by bernanke01 (Beadle) on Sep 27, 2006 at 00:45 UTC | |
by bobf (Monsignor) on Sep 27, 2006 at 03:25 UTC | |
by BrowserUk (Patriarch) on Sep 27, 2006 at 01:20 UTC |