3 ms·
How infamous Unsafe should be considered is really relative to what portion of it you want to use. If you want to use Unsafe to munge on heap objects and array
by arielweisberg 13y ago
How infamous Unsafe should be considered is really relative to what portion of it you want to use.
If you want to use Unsafe to munge on heap objects and arrays, well yeah that is pretty unsafe because the gotchas are subtle.
If you want to use it to play with native memory and work around Java's elitist (yeah I'm a little bitter) attitude towards memory management it's pretty reasonable. It's only unsafe to the extent that you aren't going to get tools like Valgrind to help you.