Hacker News new | past | comments | ask | show | jobs | submit login

> When managing resources on separate memory, RAII is also rarely something you’d want.

It's the opposite.

When managing resources in system memory, RAII is rarely something I’d want because malloc() is slow.

When managing resources on separate device, RAII is invaluable. These external resources often have API designed like bind/use/unbind, map/update/unmap and similar. You forget that one close/unbind/unmap and you violate your part of the contract i.e. anything may happen including crashes and memory leaks.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: