[Lxr-dev] [ lxr-Bugs-506627 ] Excessive memory usage
Brought to you by:
ajlittoz
From: <no...@so...> - 2002-01-21 20:48:58
|
Bugs item #506627, was opened at 2002-01-21 12:48 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=390117&aid=506627&group_id=27350 Category: genxref Group: v0.9 Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Excessive memory usage Initial Comment: LXR uses much more memory than is required. I have a large binary with debugging symbols (80+M) in my source tree and attempting to index it I get the following error. Out of memory during "large" request for 134221824 bytes, total sbrk() is 203704320 bytes at lib/LXR/Lang.pm line 42. Note the first value is equal to 128M. A quick look at the source code shows the offending line below: # Try to see if it's a script $files->getfile($pathname, $release) =~ /^#!\s*(\S+)/s; And the offending function from Plain.pm: sub getfile { my ($self, $filename, $release) = @_; my ($buffer); local ($/) = undef; open(FILE, $self->toreal($filename, $release)) || return undef; $buffer = <FILE>; close(FILE); return $buffer; } Reading the whole file into memory to determine if it is a shell script is really excessive. Surely the first line should suffice. File::Type may do a better job, but it operates only on a filename, and I'm not sure about portability. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=390117&aid=506627&group_id=27350 |