From: Jeffrey H. <jef...@aj...> - 2000-08-30 23:49:34
|
> From: Jim Ingham [mailto:ji...@ap...] ... > Moreover, when you allocate a block of memory, all that happens is > that that chunk of your address space is reserved, no real memory or > swap is set aside for it until you actually touch one of the pages. > So again, the act of doubling a 100 Meg string, for instance, doesn't > require that you have 200 Meg of swap or memory. Only the act of > actually writing to all 200 Meg of it will do that. And no algorithm ... Yes and no. Sure, the memory is just reserved, but the mem allocator will still bomb if you ask for more space than it could promise. The point of the mem efficiency part is that we don't get too greedy about needing so much more space than we need. That way we can push the boundaries of how much mem we will actually be able to use without the mem allocator crapping out because we're overly greedy. The other suggestion in the thread was a fall-back allocation mechanism, whereby one still goes for *2 all the time, until malloc says, "No". Then we would try for just what we need (or a bit more), and see if that works. However, that requires changing around the ckalloc routines, because they panic by default when malloc returns NULL. You'd have to create some sort of alternative like: bytes = (char *) ckallocEx(howMuchIWant, howMuchINeed); Jeffrey Hobbs Tcl Ambassador ho...@Aj... Ajuba Solutions (nee Scriptics) -- The TclCore mailing list is sponsored by Ajuba Solutions To unsubscribe: email tcl...@aj... with the word UNSUBSCRIBE as the subject. |