From: George H. <ga...@si...> - 2000-08-31 22:27:20
|
In message <200...@po...>, Dan Kuchler writes: : > But if one still wants to handle this within Tcl, I have a slightly : > different tact. When realloc fails, pull back the size. It can fail : > when you can't allocate even the extra space needed. : : Right. If you look at Jeff's posts from yesterday : he mentions this option. I initially proposed this : several weeks ago. The current tcl C memory allocation : APIs will panic when the allocation fails. I proposed : that a new API be added for growth algorithms where : you could specify two quantities. One would be the : bare minimum amount of space needed to continue (the : size of the initial string + the size of the appended : string). The second size would be the desired amount : of space to allocate (this would use a growth algorithm : similar to the one in the core today). Then the : allocation function would (if the allocation failed) : gradually reduce the quantity of space asked for by : some algorithm/factor until it was at the minimum. : When the minimum was reached, if the allocation failed : it would panic. : : The only issue with this was that it was probably a : little more work to implement. I think that there : is room for both solutions. One makes the core a : little more memory efficient and the other makes : the core a little more flexible in its memory : allocation. : : Alternatively, if the TCT really thinks this is : too specialized the 'large string' size could : be included at a *really* high setting, and : only those who need it could tune the core : to use it. This is a solution in need of a problem. While I think Gerhard's realloc mods sound very good, I reiterate my question. Where do you need a a 1 Gigabyte string? (BTW, that's 1/2 of a 32-bit address space). Please don't fix Tcl's growth scheme until it's broken. First, make the case for all the applications that this change fixes. Otherwise this is another Tcl pseudo-improvement. --gah -- The TclCore mailing list is sponsored by Ajuba Solutions To unsubscribe: email tcl...@aj... with the word UNSUBSCRIBE as the subject. |