Requests icon indicating copy to clipboard operation
Requests copied to clipboard

Optimize memory usage (potential memory eater)

Open kulbakin opened this issue 10 years ago • 1 comments

I've noticed Requests_IRI uses internal cache variable in 2 methods https://github.com/rmccue/Requests/blob/master/library/Requests/IRI.php#L797 https://github.com/rmccue/Requests/blob/master/library/Requests/IRI.php#L875 which potentially can eat up memory if the library is used for writing a some sort of spider which works indefinitely.

I suggest either to remove cache or replace it with implementation which would only grow up to certain limited memory space. Personally i would remove it since string operation it tries to benefit are fast and i doubt anybody would ever notice 'performance drop', but it will definitely save some nerve cells to a person who for no apparent reason gets 'out of memory' errors.

kulbakin avatar Feb 22 '15 00:02 kulbakin

Ideas:

  • Add a cache interface and separate the caching from the IRI class ?
  • Add a cache property/properties with appropriate cache setting/clearing options ?

This should be looked into after the IRI class has been updated with other changes synced in from other sources.

jrfnl avatar Feb 28 '22 20:02 jrfnl