> On 20 Jul 2020, at 18:51, Wenjun Huang <[email protected]> wrote: > > > Hi Guido, > > It's great to hear from you directly :) > > Sorry for not mentioning this earlier. The use case here is profiling. > Specifically, Scalene: https://github.com/emeryberger/scalene. > > At the moment, Scalene does stack inspection to decide if an allocation is > from the user. If there are hooks helping with the differentiation, it's > arguably more efficient. Additionally, users might want to know about memory > allocated explicitly by their objects instead of by the interpreter internals.
In my day job and open source projects I care about memory leaks and fixing them. If my code creates a list you call that user allocated? If memory increases as part of python book keeping that is counted as something else? Why is that interesting? When looking for memory leaks I have not cared about that distinction. Should I be caring? Am I missing something? Barry > > If the interpreter doesn't have this functionality already, it would probably > be difficult to add, as the existing allocation API is called throughout the > interpreter code base. > > Thanks > >> On Sun, Jul 19, 2020 at 10:39 PM Guido van Rossum <[email protected]> wrote: >> What purpose do you have in mind for making this distinction? Even if it >> could be done easily (which I doubt), why would this be useful? >> >>> On Sun, Jul 19, 2020 at 19:01 <[email protected]> wrote: >>> Hello, >>> >>> The API provided by PEP 445 makes it possible to intercept allocation >>> requests through hooks, but it seems that both user allocations and >>> interpreter allocations are sent to the hooks. >>> >>> Here, user allocations refer to those that are triggered explicitly by the >>> code (e.g. memory allocations to hold the integer created by x = 1), and >>> interpreter allocations refer to everything else (e.g. memory allocations >>> for internal states). >>> >>> I've poked around a bit in the interpreter source code, and I think such >>> differentiations aren't being done at all, so all allocations are directed >>> to the same set of API. If that's indeed the case, why is the interpreter >>> implemented this way? Would it make sense to implement the differentiation? >>> >>> Thanks >>> _______________________________________________ >>> Python-ideas mailing list -- [email protected] >>> To unsubscribe send an email to [email protected] >>> https://mail.python.org/mailman3/lists/python-ideas.python.org/ >>> Message archived at >>> https://mail.python.org/archives/list/[email protected]/message/HJQW2MWFP5AUWTRD5N2TVQWAIKIDFNJW/ >>> Code of Conduct: http://python.org/psf/codeofconduct/ >> -- >> --Guido (mobile) > _______________________________________________ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/H33JNM67O3OYAGOLCDHURPFT6IDAU4ZH/ > Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/SF272PQLJTFAN66XECUXU7Z7NHQER7TG/ Code of Conduct: http://python.org/psf/codeofconduct/
