Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #1754
| From | BGB <cr88192@hotmail.com> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: reference count size |
| Date | 2012-06-07 23:55 -0500 |
| Organization | albasani.net |
| Message-ID | <jqs0nl$4fv$1@news.albasani.net> (permalink) |
| References | <233b32fd-bdfc-4ffb-a9da-320abb11c07d@googlegroups.com> <jqqkin$2bu$2@dont-email.me> |
On 6/7/2012 11:23 AM, BartC wrote: > > > "bob" <bob@coolfone.comze.com> wrote in message > news:233b32fd-bdfc-4ffb-a9da-320abb11c07d@googlegroups.com... >> What is the typical size of a reference count? 32 bits? So, does this >> add 4 bytes to the size of every object? > > Reference counts are typically used with heap-allocated objects, which > may already have overheads beyond the size of the object, might have a > minimum size anyway, and are generally used for objects bigger then > 32-bits. So the few extra bytes is usually not significant. > FWIW, my GC uses considerably fewer bits, more around 3, and in the case where more than about 6 references exist, it counts as a "many" reference, where ref-counts no longer apply (only mark/sweep can free such an object). probably 8 or 16 bits would be plenty, provided it saturates in the off chance the limit is reached. note that objects in this GC have an 8 byte object header, which also encodes the size, type, and some other information about the object (note that small objects have their space managed by a bitmap, whereas large objects use a free-list allocator). but, doing stuff this way results in considerable memory savings for objects < 100 bytes or so (albeit costs are still a bit steep for objects <=16 bytes). efficiently allocating lots of 4-16 byte objects would likely require some sort of slab allocator though.
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar
reference count size bob <bob@coolfone.comze.com> - 2012-06-07 08:42 -0700
Re: reference count size "BartC" <bc@freeuk.com> - 2012-06-07 17:23 +0100
Re: reference count size BGB <cr88192@hotmail.com> - 2012-06-07 23:55 -0500
Re: reference count size "BartC" <bc@freeuk.com> - 2012-06-08 16:52 +0100
Re: reference count size BGB <cr88192@hotmail.com> - 2012-06-09 09:11 -0500
Re: reference count size Robert Wessel <robertwessel2@yahoo.com> - 2012-06-07 11:32 -0500
Re: reference count size "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-06-09 10:29 +0100
Re: reference count size Ian Collins <ian-news@hotmail.com> - 2012-06-09 21:43 +1200
Re: reference count size JJ <jaejunks@googlemail.com> - 2012-06-08 01:46 +0700
Re: reference count size Willem <willem@toad.stack.nl> - 2012-06-07 18:52 +0000
csiph-web