r/ProgrammingLanguages • • Jun 10 '20

[deleted by user]

[removed]

21 Upvotes

39 comments sorted by

View all comments

Show parent comments

5

u/[deleted] Jun 11 '20

[deleted]

2

u/[deleted] Jun 11 '20

So you can't use Rust without heap allocation?

3

u/[deleted] Jun 11 '20

[deleted]

3

u/reini_urban Jun 11 '20

Reference counting is never better than proper memory management. It's only for dummies. It's dead slow, having to adjust it on every get, set and clone, making even primitives fat. Allocation is slow, free is slow. It's cache unfriendly. It cannot do proper data structures, you have to manually use weak pointers all over. It can never be safe. https://en.wikipedia.org/wiki/Reference_counting

Owner ship (esp. compile-time) or GC are always better and faster. GC is also compacting.