Reply to post:

Rust in peace: Memory bugs in C and C++ code cause security issues so Microsoft is considering alternatives once again

bombastic bob Silver badge
Facepalm

javascript - stupidest choice EVAR for writing anything but simple web thingies in. Even THEN, it's so HORRIBLY ABUSED in web pages already.

nefficient, interpretive lingo, garbage collection memory management, piggy bass-ackwards "object" (read: stupidity) oriented as in "ooh look we have OBJECTS! Let's USE them!" without thought as to what that implies or results in... and so on.

If you have memory problems, the SAME KINDS of memory problems popping up ALL OF THE TIME, that means two specific things in a large organization with many developers:

a) LACK of PROPER STANDARDS

b) LACK of PROPER MANAGEMENT.

To fix the REAL problem, you need PROPER STANDARDS. We begin with how to handle memory allocation and object life.

1. reference counting - when someone hands you an object, increase its ref count immediately, then lower it when you're done

2. ALWAYS NULL OUT POINTERS AFTER YOU DE-REF THEM [this makes any use-after-free condition that MIGHT be added 5 years from now sh9ow up almost immediately in testing)

3. NEVER free memory in one function that was allocated in a different one, outside of the context of object reference counts.

4. NEVER touch the internals of one object (or function) with anything OTHER than that object

5. ALWAYS PERFORM SIZE CHECKING ON WRITE OPERATIONS TO BUFFERS (and don't get the size wrong)

other things like 'guard pages' around memory blocks [which would throw page faults if you exceed boundaries] can also help in debug code, but production code at LEAST needs to do what I just said, and probably a whole lot more.

If you enforce PROPER STANDARDS (like those) the "bite you in the ass later" memory problems should pretty much go away. You know, like maybe LINUX???

Replacing EFFICIENT with BULLCRAP, though... THAT is NO solution!

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon