Show memory from outer context [skip ci]

This commit is contained in:
Andrew Kane
2024-04-11 18:38:35 -07:00
parent e6a591275a
commit 94ee6b13c3

View File

@@ -176,13 +176,13 @@ QuickCenters(Relation index, VectorArray samples, VectorArray centers, IvfflatTy
* Show memory usage * Show memory usage
*/ */
static void static void
ShowMemoryUsage(Size estimatedSize) ShowMemoryUsage(MemoryContext context, Size estimatedSize)
{ {
#if PG_VERSION_NUM >= 130000 #if PG_VERSION_NUM >= 130000
elog(INFO, "total memory: %zu MB", elog(INFO, "total memory: %zu MB",
MemoryContextMemAllocated(CurrentMemoryContext, true) / (1024 * 1024)); MemoryContextMemAllocated(context, true) / (1024 * 1024));
#else #else
MemoryContextStats(CurrentMemoryContext); MemoryContextStats(context);
#endif #endif
elog(INFO, "estimated memory: %zu MB", estimatedSize / (1024 * 1024)); elog(INFO, "estimated memory: %zu MB", estimatedSize / (1024 * 1024));
} }
@@ -280,7 +280,7 @@ ElkanKmeans(Relation index, VectorArray samples, VectorArray centers, IvfflatTyp
elog(ERROR, "Unsupported type"); elog(ERROR, "Unsupported type");
#ifdef IVFFLAT_MEMORY #ifdef IVFFLAT_MEMORY
ShowMemoryUsage(totalSize); ShowMemoryUsage(oldCtx, totalSize);
#endif #endif
/* Pick initial centers */ /* Pick initial centers */