You know the PHP legacy code base is complete garbage when it requires a script memory limit of 1.5GB.

  • 3
    When you generate hundred page PDFs in PHP...
  • 1
    Please tell me it generates some large files and stores it in memory.
  • 2
    Really depends on what it's doing.
  • 1
    What if I'm processing gb's of csv files? Memory limit = 0 for a reason 🙃
  • 3
    @C0D4 0 memory limit only works in CLI SAPI
    @Oktokolo @Lensflare It "only" loads whole DB tables into class properties in the constructor. The data is barely used.
    I think these bastards tried to minimize DB calls thus "optimize" the "app"...
  • 1
    @PonySlaystation eh yeah that is not a valid usecase. That's just badly implemented cashing.
  • 1
    @C0D4 could be a valid use case if streaming is not an option.
  • 1
    @hjk101 what could be a case where streaming is not an option?
  • 1
    @Lensflare where she data cannot be handled in a single pass but needs to be accessed all over the place. Sorting is such an example.
    If memory is constrained but performance is not than it might be beneficial to save it as a stream to persistent storage in a more beneficial format and do the processing from there.
    For example saving records to a database and just let a query sort it would be way better.
    I've worked with environments where input data (patient data) was not allowed to hit the disk. That was challenging in dime aspects.
Add Comment