mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-14 00:26:55 +08:00
Show memory from outer context [skip ci]
This commit is contained in:
@@ -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 */
|
||||||
|
|||||||
Reference in New Issue
Block a user