integer size

David Gillies daggillies at
Fri Oct 1 10:42:26 CEST 2010

On Thu, Sep 30, 2010 at 7:14 PM, Ron Croonenberg
<ron.croonenberg at> wrote:
> Ok,  I am not 'just; poking around, I am processing a lot of data (pretty much a few billion strings) and I need to meaningful tag them, in a metric kind of way. after I do that I can process them and even though I have a lot of ram, I still want to do it as efficiently as possible.
> One of the things I need to know for that is how much, in bytes, space a bunch of these things use.
> So I am looking for an exact size (like I would find with using sizeof on regular data structures.)

You say this, but in a previous post you say you don't know what limbs
are (which is a bit like asking how to efficiently multiply something
by four and saying, "don't give me any of that crap about left shift
by two bits, because I don't know what that means":) You are asking
for an implementation-specific metric while explicitly disavowing
knowledge of the implementation. There is no simple answer here.
Either get your hands dirty and delve into the actual details of the
allocator or else use heuristics like size in base 256 plus some
headroom. There's no in-between.

David Gillies
San Jose
Costa Rica

More information about the gmp-discuss mailing list