azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

[BUG] Azure Func Python Library: AppExtensionBase - potential small memory leak

Open nhtgl opened this issue 1 year ago • 0 comments

I'm referring to this code https://github.com/Azure/azure-functions-python-library/blob/dev/azure/functions/extension/app_extension_base.py#L65-L70

    @classmethod
    def pre_invocation_app_level(cls,
                                 logger: Logger,
                                 context: Context,
                                 func_args: typing.Dict[str, object] = {},
                                 *args,
                                 **kwargs) -> None:

and line func_args: typing.Dict[str, object] = {}, is troubling me, because code initializes default argument with mutable type. AFAIK that can cause a memory leak in general (https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments), but maybe in the context how it's run it's not a problem.

Not sure if this is a real problem. My app has some memory leaks, but it's not that painful, so I wasn't investigating it much.

nhtgl avatar May 22 '24 08:05 nhtgl