Tcl 变量的存储容量 [英] Storage Capacity of Tcl Variable

查看:29
本文介绍了Tcl 变量的存储容量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想将整个文件存储在 tcl 变量中.所以让我知道,Tcl 变量的存储容量是多少?

Just I want to store a entire file in the tcl variable. So let me know, What is the the Storage Capacity of Tcl Variable ?

推荐答案

Tcl 的当前限制为 2 GiB(即使在 64 位系统上,因为用于实体大小的类型中存在旧的 API 缺陷)用于C 级别的任何对象"的大小.对于字符串,这意味着为了安全起见,您可能需要坚持少于大约 10 亿个字符(尽管确切的限制会因您正在执行的操作的细节而异).对于列表,在 32 位机器上,这将您限制为大约 5 亿个列表项(提供,您永远不会获得列表的字符串表示),而这个限制是 64 位机器上的一半;您可以使用嵌套列表来解决此问题,因为限制仅在底层数组的大小中.字典可能会更大,但我不会推荐它(并且可能不会超过 20 亿个条目,因为上述 API 拙劣,但请参阅与嵌套相关的同样适用的评论).

Tcl has a current limit of 2 GiB (even on 64-bit systems, because of an old API botch in the type used for the size of entities) for the size of any "object" at the C level. For strings, this means that you probably need to stick to less than about 1 billion characters for safety (though the exact limit will vary depending on the details of what you are doing). For lists, on a 32-bit machine this limits you to about 500 million list items (provided you never get the string representation of the list) and the limit is half that on a 64-bit machine; you can use nested lists to work around this as the limit is just in the size of the underlying array. Dictionaries can probably go even larger, but I wouldn't recommend it (and probably can't go over 2 billion entries anyway because of the aforementioned API botch, though see the equally applicable comments relating to nesting).

您还受到操作系统和机器架构施加的限制.当然.

You're also subject to the limits your OS and machine architecture imposes. Of course.

如果您正在处理非常大的数据,强烈建议您使用 Tcl 8.6.1(或更高版本),因为它可以更好地解决因内存分配问题而导致的软故障.

If you're working with very large data, you are strongly recommended to use Tcl 8.6.1 (or later) as that is better at doing soft failures from memory allocation problems.

这篇关于Tcl 变量的存储容量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆