[Python-Dev] Re: PEP 683: "Immortal Objects, Using a Fixed Refcount"
On Sat, 19 Feb 2022 12:05:22 -0500 Larry Hastings wrote: > On 2/19/22 04:41, Antoine Pitrou wrote: > > On Fri, 18 Feb 2022 14:56:10 -0700 > > Eric Snow wrote: > >> On Wed, Feb 16, 2022 at 11:06 AM Larry Hastings > >> wrote: > >>> He suggested(*) all the constants unmarshalled as part of loading a > >>> module should be "immortal", and if we could rejigger how we allocated > >>> them to store them in their own memory pages, that would dovetail nicely > >>> with COW semantics, cutting down on the memory use of preforked server > >>> processes. > >> Cool idea. I may mention it in the PEP as a possibility. Thanks! > > That is not so cool if for some reason an application routinely loads > > and unloads modules. > > Do applications do that for some reason? Python module reloading is > already so marginal, I thought hardly anybody did it. I have no data point, but I would be surprised if there wasn't at least one example of such usage somewhere in the world, for example to hotload fixes in specific parts of an application without restarting it (or as part of a plugin / extension / mod system). There's also the auto-reload functionality in some Web servers or frameworks, but that is admittedly more of a development feature. Regards Antoine. ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/C2MWXHPOFFH5CLLPKJCVEQD4EGHKTD24/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: PEP 683: "Immortal Objects, Using a Fixed Refcount"
While I don't think it's fine to play devil's advocate, given the choice between "this will help a common production use-case" (pre-fork servers) and "this could hurt a hypothetical production use case" (long-running applications that reload modules enough times this could waste a significant amount of memory), I think the former is more important. //arry/ On 2/20/22 06:01, Antoine Pitrou wrote: On Sat, 19 Feb 2022 12:05:22 -0500 Larry Hastings wrote: On 2/19/22 04:41, Antoine Pitrou wrote: On Fri, 18 Feb 2022 14:56:10 -0700 Eric Snow wrote: On Wed, Feb 16, 2022 at 11:06 AM Larry Hastings wrote: He suggested(*) all the constants unmarshalled as part of loading a module should be "immortal", and if we could rejigger how we allocated them to store them in their own memory pages, that would dovetail nicely with COW semantics, cutting down on the memory use of preforked server processes. Cool idea. I may mention it in the PEP as a possibility. Thanks! That is not so cool if for some reason an application routinely loads and unloads modules. Do applications do that for some reason? Python module reloading is already so marginal, I thought hardly anybody did it. I have no data point, but I would be surprised if there wasn't at least one example of such usage somewhere in the world, for example to hotload fixes in specific parts of an application without restarting it (or as part of a plugin / extension / mod system). There's also the auto-reload functionality in some Web servers or frameworks, but that is admittedly more of a development feature. Regards Antoine. ___ Python-Dev mailing list --python-dev@python.org To unsubscribe send an email topython-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived athttps://mail.python.org/archives/list/python-dev@python.org/message/C2MWXHPOFFH5CLLPKJCVEQD4EGHKTD24/ Code of Conduct:http://python.org/psf/codeofconduct/___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/VYGLHB4JXSYKTNJ2AOLDFUKO4GDHWVIV/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: PEP 683: "Immortal Objects, Using a Fixed Refcount"
On Mon, 21 Feb 2022 at 16:47, Larry Hastings wrote: > > > While I don't think it's fine to play devil's advocate, given the choice > between "this will help a common production use-case" (pre-fork servers) and > "this could hurt a hypothetical production use case" (long-running > applications that reload modules enough times this could waste a significant > amount of memory), I think the former is more important. > Can the cost be mitigated by reusing immortal objects? So, for instance, a module-level constant of 60*60*24*365 might be made immortal, meaning it doesn't get disposed of with the module, but if the module gets reloaded, no *additional* object would be created. I'm assuming here that any/all objects unmarshalled with the module can indeed be shared in this way. If that isn't always true, then that would reduce the savings here. ChrisA ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/7XDU2THWGEX2YUD32VYY5FJXL4GFQ675/ Code of Conduct: http://python.org/psf/codeofconduct/