[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 'out of memory' errors

On Monday 01 May 2006 06:13 am, Linas ?virblis wrote:
> 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.

thanks for the ideas. 'File::Stream' in perlland seems to me to be one 
instance of what you mean. or - my method tho' i don't call it streaming - do 
something with 'read()' and a regex to get the big chunks. but, to my way of 
thinking, what's in physical memory and what's on disk should be the business 
of the system, not the application. oh, well. 

tom arnall
north spit, ca

Reply to: