WordPress / WordPress/Requests
Optimize memory usage (potential memory eater)
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 500
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 5
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in library/Requests/IRI.php at the two cache uses around lines 797 and 875. Inspect how those methods populate and read the cache, then confirm the chosen change prevents unbounded growth during long-running spider use without changing IRI behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100