Hello, I am just starting to get my feet wet with PostgreSQL development and am starting to understand the source, so please be kind 😊. I am working on the REL_11_4 tag.
When CachedPlanSource instances are created the field query_string is filled with pstrdup(query_string) in CreateCachedPlan, plancache.c:182, which is just a wrapper for strdup. According to the docs the returned pointer should be freed with “free” sometimes later. I believe in DropCachedPlan the free should take place but I don’t see it. Is it just missing or is memory allocated by strdup and friends automatically created in the current MemoryContext? It so, why do I need to use palloc() instead of malloc()? Kind regards, Daniel Migowski