TBH this would have happened if they used the same approach in any language, and wouldn't have happened if they used a different approach in C.
They wrote their own allocator. That's the problem. If they didn't use their own allocator valgrind or sanitisers would have caught this.
If they used this approach in any other language, like Java or C#, heartbleed would still have happened.