SparseDelegateReport

SparseDelegateReport

#Overview

name: SparseDelegateReport

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of SparseDelegateReport is to provide a diagnostic tool for examining and reporting on the current state of sparse delegates in Unreal Engine 5. It’s primarily used for debugging and analyzing the delegate system within the engine.

This functionality is part of the CoreUObject module in Unreal Engine 5, specifically within the sparse delegate system. The sparse delegate system is an optimization technique used to reduce memory usage for delegates that are not always bound.

The value of this variable is not set directly. Instead, it’s used as a command name for an FAutoConsoleCommand, which allows developers to trigger the report generation from the console.

The SparseDelegateReport function interacts with several other variables and systems:

  1. It takes arguments (Args) which can filter the report based on object name, delegate name, or class name.
  2. It uses an FOutputDevice (Ar) to output the report.
  3. It likely interacts with the UObject system to gather information about bound delegates.

Developers should be aware that:

  1. This is a diagnostic tool and should be used primarily for debugging and performance analysis.
  2. The report can be filtered using various parameters (name, delegate, class).
  3. There’s a -details flag that can provide more comprehensive information.

Best practices when using this variable/command:

  1. Use it during development and testing phases to understand delegate usage in your project.
  2. Combine it with performance profiling to identify potential optimization opportunities in delegate usage.
  3. Be cautious about using it in shipping builds, as it may have performance implications when generating large reports.
  4. Utilize the filtering options to focus on specific areas of interest in your codebase.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/SparseDelegate.cpp:351

Scope: file

Source code excerpt:


FAutoConsoleCommand SparseDelegateReportCommand(
	TEXT("SparseDelegateReport"),
	TEXT("Outputs a report of what sparse delegates are bound. SparseDelegateReport [name=<ObjectName>] [delegate=<DelegateName>] [class=<ClassName>] -details"),
	FConsoleCommandWithWorldArgsAndOutputDeviceDelegate::CreateStatic(FSparseDelegateStorage::SparseDelegateReport)
);

void FSparseDelegateStorage::SparseDelegateReport(const TArray<FString>& Args, UWorld*, FOutputDevice& Ar)
{

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Private/UObject/SparseDelegate.cpp:356

Scope (from outer to inner):

file
function     void FSparseDelegateStorage::SparseDelegateReport

Source code excerpt:

);

void FSparseDelegateStorage::SparseDelegateReport(const TArray<FString>& Args, UWorld*, FOutputDevice& Ar)
{
	UClass* ObjectType = nullptr;
	FName ObjectName = NAME_None;
	FName DelegateName = NAME_None;
	bool bSummary = true;
	bool bArgumentError = false;

#Loc: <Workspace>/Engine/Source/Runtime/CoreUObject/Public/UObject/SparseDelegate.h:78

Scope: file

Source code excerpt:


	/** Outputs a report about which delegates are bound. */
	static COREUOBJECT_API void SparseDelegateReport(const TArray<FString>&, UWorld*, FOutputDevice&);

private:

	struct FObjectListener : public FUObjectArray::FUObjectDeleteListener
	{
		virtual ~FObjectListener();