Skip to content
Tcl Source Code Artifact [0ea9279db6]
Login

Artifact [0ea9279db6]

Artifact 0ea9279db601f2f8ede0166f07e22e7ecd5bcc5c:

Ticket change [0ea9279db6] - New ticket [1299153fffffffff|1299153fff] <i>MP_PREC is too large</i>. by dgp on 2005-09-22 21:37:51.
D 2005-09-22T21:37:51
J assignee kennykb
J cmimetype text/plain
J comment \nThe\slibtommath\slibrary\shas\sa\nconfiguration\svalue\sMP_PREC\nthat\sspecifies\sthe\sminimum\snumber\nof\smp_digits\sin\san\smp_int.\s\sThe\ndefault\svalue\sof\sMP_PREC\sis\s64.\n\nThis\smeans\sthat\sonce\san\sinteger\nvalue\sis\stoo\slarge\sto\sfit\sin\sa\sTcl_WideInt,\nthe\sstorage\srequirements\sballoon\sfrom\n8\sbytes\sto\shold\s64\sbits\sto\s256\sbytes\njust\sfor\sthe\sdigits\sarray\sholding\s64\s4-byte\nmp_digits\sto\shold\s65\sbits.\n\nEven\sworse\sis\sthe\sTcl\sroutine\nTclBNInitBignumFromLong()\nwhich\scalls\smp_init_size().\s\sThrough\nsome\squirkiness\sin\slibtommath,\nmp_init_size\sactually\screates\san\nmp_int\swith\sa\sminimum\sof\n2*MP_PREC\smp_digits.\s\sSo\swhen\nwe're\sexplicitly\screating\san\nmp_int\sto\shold\sa\slong\svalue\s--\sone\swe\nknow\swill\sfit\sin\stwo\smp_digits\s--\swe're\nforced\sto\sallocate\s128\smp_digits,\sor\na\swhopping\s512\sbytes,\sjust\sfor\sthe\ndigits\sarray.\n\nThese\sdefaults\smay\sbe\sappropriate\nfor\ssome\sclients\sof\slibtommath,\sbut\nthey're\snot\sa\sgood\sfit\sfor\sTcl\sto\srequire\nsuch\san\sexplosion\sof\smemory\sexpense\njust\sto\scross\sover\sinto\smp_int's.\n\nThere\sis\san\sMP_LOW_MEM\sconfiguration\nthat\ssets\sMP_PREC\sto\s8\srather\sthan\s64.\nThat\swould\shelp\sa\slot,\sbut\seven\sthat\sseems\ntoo\sabrupt\sacross\sthe\swide->bignum\stransition.\nA\svalue\sof\sMP_PREC\s=\s4\swould\sseem\sto\sbe\na\sbetter\sfit\sfor\sTcl's\sbignum\sneeds.\n\nEven\swith\sthat\srevision,\swe\sshould\sprobably\nrewrite\sTclBNInitBignumFromLong\sto\navoid\smaking\sa\scall\sto\smp_init_size().\nOther\smp_init_size()\scallers\sought\sto\sbe\nexamined\sas\swell.\n\n
J foundin obsolete:\s8.5a4
J priority 5\sMedium
J resolution None
J status Open
J submitter dgp
J subsystem 10.\sObjects
J title MP_PREC\sis\stoo\slarge
J type Bug
K 1299153fffffffffffffffffffffffffffffffff
U dgp
Z 81b0840bf96518472b8143222b71e123