DEV Community

Discussion on: StringBuffer in Dart

 
infiniteoverflow profile image
Aswin Gopinathan

Okay ! Now i get it.
It's really interesting how GC is handled in Dart. Makes me wanna explore more on that !

Thanks again for sharing your insights.

Thread Thread
 
mraleph profile image
Vyacheslav Egorov

FWIW GCs are never invoked after each allocation - that would be prohibitively expensive, so there is nothing Dart specific here.

You might have been thinking about how some languages use reference counting which would free the memory occupied by an object immediately after the last reference to it disappears.

Thread Thread
 
infiniteoverflow profile image
Aswin Gopinathan

Yeah, i have been following the same concept here. Guess i didnt go about it the right way !

So, the languages that incorporate reference counting approach to freeing a memory immediately is less efficient ? Or did i miss anything ?