News for hackers. Stuff that matters.
Re:So We've Got a Memory Leak by mattpallissard on Saturday May 11, 2024 @01:55PM (#40329606)
I think the rift comes from people thinking manual memory management is a bunch of random allocs and frees all over the place. That is gross and those of us who don't mind managing memory don't like it either.

Personally my gripe is when people don't think about memory or space complexity at all. I don't care if it's a custom memory management strategy or GC'd language, you need to think about it. I have the same gripe about persistence, socket programming, and database queries.

Abstractions are great, use them, love them. But understanding what the hell they are doing under the hood not only improves efficiency, it prevents bugs, and gives you a really solid base when reasoning about unexpected behavior.

Re:So We've Got a Memory Leak by Dylan16807 on Saturday May 11, 2024 @03:50PM (#40330244)
If the automatic allocation tools are good, then they're doing the same thing as quality manual management but with much more compiler enforcement.
Re:So We've Got a Memory Leak by mattpallissard on Sunday May 12, 2024 @11:08AM (#40335090)
Not exactly, GC is a general solution. Manual management can be tailor made. But to your point more compiler enforcement is a good thing.
Re:So We've Got a Memory Leak by Dylan16807 on Sunday May 12, 2024 @11:17AM (#40335154)
I didn't mean just GC. Automated memory management comes in many forms and can be pretty specific.

And it can be tailored too if a situation really deserves it. If I'm doing something custom I want the smallest amount of code to verify, just the special memory manager and not everything that uses it.

Re:So We've Got a Memory Leak by mattpallissard on Sunday May 12, 2024 @01:32PM (#40336085)
True, I misread your original reply.
Re:So We've Got a Memory Leak by pjmlp on Saturday May 11, 2024 @03:51PM (#40330253)
Which is actually the case in enterprise source code, touched by hundreds of offshoring companies.
Re:So We've Got a Memory Leak by mirsadm on Saturday May 11, 2024 @02:11PM (#40329697)
Any professional developer should understand these things. It was taught at first year of my computer science degree. As you say it isn't particularly difficult if you have a strategy. If you can't manage memory then what about any other resource that needs to be manually closed (sockets, file handles etc ).
Re:So We've Got a Memory Leak by da_chicken on Saturday May 11, 2024 @02:53PM (#40329919)
I'm not sure I understand the causal link between something having a proven track record of being error-prone and not understanding it.
Re:So We've Got a Memory Leak by prerok on Saturday May 11, 2024 @05:00PM (#40330604)
The problem is that automatic memory management means to some newcomers that you don't have to worry about it. Which is not true at all.

These newcomers may have heard about it, may even understand it at some level, but it's not in their rote knowledge. GC is great if you know that every allocation you do is expensive and that you know that it will be taken care of properly, because it will be short-lived.

But I have seen many cases where people just don't have it in their conciousness why allocating huge arrays is a problem or why allocating a new Character object for every single character in a string might be bad. As soon as I point it out, they get it, but it's not like they thought of it while writing their algorithm.

Re:So We've Got a Memory Leak by danielledias204 on Sunday May 12, 2024 @10:34PM (#40339301)
But for most developers using GC (Garbage Collected) languages, not understanding these concepts does not affect their ability to earn a salary and continue working.