|
|
|
|
|
by mherkender
4722 days ago
|
|
That's an interesting idea, but how does a language distinguish between memory leaks and regular non-leaks? Maybe some kind of metadata that informs the GC about how memory will be used so it can optimize memory usage and issue errors when the code fails to follow these rules? If we really start hitting these kinds of walls, I think that Javascript subsets (like asm.js) will become more prominent, but it's an interesting idea. |
|
But people still need to be aware of it first; making new objects for one time use is handy, and the normal way to go about things. It's certainly the default way tutorials tell you to get the time (even in game loops). At least personally, before today I didn't even know about Date.now(), and I never saw a discussion about any of this stuff in regards to libraries (how good or sloppy they are with GC)... it just doesn't seem to be on the radar, outside of gamedev. And by the time stuff gets sluggish by the accumulated little objects here and there, there is no easy fix, other than a whole lot refactoring or rewriting from scratch with it in mind.