Hacker News new | ask | show | jobs
by no_wizard 2126 days ago
Manipulating complex data structures that are large and/or trying to manage long running processes cause memory leaks. I often find I have to jump through hoops I don't have to in other languages to deal with these kinds of problems, for instance.

I usually have to resort to queues, which just adds complexity where I typically don't want it.

1 comments

> Manipulating complex data structures that are large

I do assume it's not the case, but one of the footguns with PHP is that assigning around large variables/arrays and triggering the copy-on-write can end building up the amount of duplicates of that data being kept alive. Pass by reference, unsets, generators and the like aren't used super often due to a lot of runs being small stateless requests, but sometimes they may be needed.

We resorted to only giving PHP ready to transmute data, so it didn’t handle any of the manipulation unless it was straightForward based on our own criteria, but anything involving too much searching or filtering (yes I realize there are other problems here, but our scale was large enough that these problems had to be tackled piecemeal, and aren’t relevant beyond that for this discussion)

Ultimately I’ve had less issues with Python for this type of workload and is eventually where we moved.