Boost logo

Boost :

Subject: Re: [boost] [uuids] generating uuids from multiple threads
From: Scott McMurray ([hidden])
Date: 2009-01-09 22:27:23

On Fri, Jan 9, 2009 at 19:11, Michael Marcin <mike.marcin_at_[hidden]> wrote:
> How expensive is it in terms of memory to store a static or thread local
> uuid_generator for the length of the program? I only expect this to be
> called maybe twice. The application will run on memory constrained mobile
> devices.

The random-based generator is essentially just a wrapper on the
(P)RNG, so it'll take as much storage as the PRNG. (v13 stores the
variate generator too, but I think that'll change, since afaik that's
cheap to construct.)

There's a nice table with memory requirements here:

So while the default PRNG needs 625*sizeof(uint32_t) of state, you
could use a basic_uuid_generator<rand48>, which will need only 64 bits
of storage. (Plus apparently at least 64 bits for the generator, but
you can get rid of that easily enough by changing the uuid generator
to construct it on demand.)

~ Scott

Boost list run by bdawes at, gregod at, cpdaniel at, john at