Re: 'out of memory' errors
- To: debian-user@lists.debian.org
- Subject: Re: 'out of memory' errors
- From: Linas Žvirblis <0x0007@gmail.com>
- Date: Mon, 01 May 2006 16:13:27 +0300
- Message-id: <[🔎] 44560977.50002@gmail.com>
- In-reply-to: <200604301803.57005.kloro@cox.net>
- References: <200604291528.47789.kloro@cox.net> <200604301426.35374.kloro@cox.net> <44554B0D.1050601@gmail.com> <200604301803.57005.kloro@cox.net>
tom arnall wrote:
>> What about streams then?
>
> please tell me how that would work? i'm not familiar with the mechanism.
You could open a file as a stream (or a buffer, it is the same thing),
read it in chunks of reasonable length (maximum length you expect the
longest regex match would span), and advance by one char, for example.
Something like this...
|----------- $number of chars -----------|-----------
-|----------- $number of chars -----------|----------
--|----------- $number of chars -----------|---------
---|----------- $number of chars -----------|--------
There are many ways to implement this and similar algorithms. Google for
perl, buffers, streams, and regexes to locate examples.
Reply to: