dskvr / opkg

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

opkg reads the whole package list into memory #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
During install / remove / list etc. operations opkg reads all lines of the
package list into memory and then iterates over those lines to build the
package hash table. This consumes more memory than actually needed. It
would be better to populate the hash table on the fly while reading the
list. This way memory wasting can be avoided and the processing happens in
one pass.

Attached is a proof-of-concept patch to address this - it uses a fixed
buffer to read the list file and the calling code was modified to populate
the hash table on the fly without reading the while list first. It also
suppresses the processing of package descriptions for most operations
reducing the required amount of memory even further. There is one
limitation with the suggested approach, the maximum line length is limited
to 4096 bytes, if a line exceeds this limit, the parsing will be aborted
and an error is returned.

Original issue reported on code.google.com by goo...@wwsnet.net on 22 Oct 2009 at 4:17

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the patch. A slightly different fix committed as r283.

Original comment by graham.g...@gmail.com on 11 Nov 2009 at 3:26