How did you get to the conclusion that there are only as many bytes allocated by Arc as T takes?
Ah, that is my mistake. I have totally missed that! My original conception of the article came from one of my projects when I realized that I could use a Box<str> over a String. Then, as I wrote this article, I wanted to apply the same optimization over multi-threaded contexts via Arc. It had not occurred to me (until you mentioned it) that Arc actually has some overhead due to atomics, which Box does not have. I had falsely assumed otherwise.
This led to my incorrect conclusion that Arc allocates as Box would. So to make a long story short, I had unintentionally disregarded the Arc overhead, thinking that it was a Box.
Thanks for pointing this out! I shall edit the article accordingly.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Ah, that is my mistake. I have totally missed that! My original conception of the article came from one of my projects when I realized that I could use a
Box<str>
over aString
. Then, as I wrote this article, I wanted to apply the same optimization over multi-threaded contexts viaArc
. It had not occurred to me (until you mentioned it) thatArc
actually has some overhead due to atomics, whichBox
does not have. I had falsely assumed otherwise.This led to my incorrect conclusion that
Arc
allocates asBox
would. So to make a long story short, I had unintentionally disregarded theArc
overhead, thinking that it was aBox
.Thanks for pointing this out! I shall edit the article accordingly.