>>>>> "GvR" == Guido van Rossum <guido@python.org> writes: >> > I'm about to start working on this one and wanted to check here >> > first to make sure there is still a demand for it [...] >> >> Yes, please! I have wished for this many times as I struggled to >> figure out which part of my program was using up too much RAM. GvR> But the question is incredibly ill-defined, so it's not clear GvR> that Raymond will be able to calculate a useful answer. (See GvR> Tim's post.) We've gone through the exercise of figuring out how much memory is used by a dictionary several times in the office here. It's instructive to repeat the exercise, because it illustrates how hard it is to come up with a good answer :-). The basic dictionary structure is 132 bytes on i686, but the hash table is (usually) a separately malloced chunk of memory that contains the dict entries. The details of the actual table layout aren't of interest in dict_traverse(), which just gets the valid dict entries, but the layout would be of interest to something like sizeof(). If the sizeof() function were going to really be useful, builtin types would presumably need to define a slot to compute their size. Even this would overlook malloc overhead, which could well be nontrivial if an object contains several malloced buffers. Jeremy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4