Overview
| Artifact ID: | 507b6b1460d3d3cf108b199c72849280144225f5a4a1536f211fcd4db8d1653f |
|---|---|
| Ticket: | c9663296fd31fbb2fa1ff1cf019b59f432983516
GrowStringBuffer and GrowUnicodeBuffer do not check for overflows |
| User & Date: | anonymous on 2023-05-05 19:41:57 |
Changes
- icomment:
Hi Ashok, Around 2012/2013, I did some larger tests and changes for Tcl 8.5.13 experiencing with different mallocs and Tcl-internal malloc-growing strategies (also trying the python growth scheme). I think, we are still using this changes in our (highly busy) live-system (ported to 8.6). With smaller growth factors, one is trading memory waste vs. realloc frequencies, which are more problematic on multi-threaded applications. My experience was that doubling is quite good up to a certain size, but then, the policy should be altered (if one adds 1 byte to a 1GB string, 2GBs are most likely an overkill). By looking at the malloc implementations, it made also sense to over-alloc in multiple of units, which are used by the malloc implementations anyhow (e.g. page sizes). I also added some monitoring code (via compile-time switches) to monitor large reallocs. I also remember, that there were several places to touch (such as DStrings, Tcl_Objs, Lists, ...) I have just a write-up of the malloc implementation tested [1]. We are also using since a few years a system-malloc patch, which makes it easier to use different malloc implementations as replacement for Tcl's threaded malloc. We still use Google's tclmalloc, although, since a few years, the standard Linux malloc became quite good. Let me know if you are interested in that code. -gustaf [1] https://next-scripting.org/2.4.0/doc/misc/thread-mallocs/index1
- login: "anonymous"
- mimetype: "text/x-markdown"