You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For monitoring live memory allocations in an application, and comparing before/after in a call stack, it can make sense to have a different sort order, for instance on the "Name" or InstanceCount of the TMemoryLogNode item.
As far as I can see now this would require a couple of changes:
introduce a mechanism to specify the sort order (could as simple as an enumeration type or set of enumeration type with default value to mean TotalMemoryUsage)
abstract the name generation part of LogMemoryManagerStateToFile into a separate method
abstract comparison of two TMemoryLogNode items into a separate method similar to System.Generic.Collections.TList.Sort (IComparer<T>) but without using interfaces (and implementations that avoid allocating heap memory)
adopt these methods to allow for a different sorting mechanism:
Currently this method sorts by
TotalMemoryUsage
:For monitoring live memory allocations in an application, and comparing before/after in a call stack, it can make sense to have a different sort order, for instance on the "Name" or
InstanceCount
of theTMemoryLogNode
item.As far as I can see now this would require a couple of changes:
TotalMemoryUsage
)LogMemoryManagerStateToFile
into a separate methodTMemoryLogNode
items into a separate method similar toSystem.Generic.Collections.TList.Sort (IComparer<T>)
but without using interfaces (and implementations that avoid allocating heap memory)procedure QuickSortLogNodes(APLeftItem: PMemoryLogNodes; ARightIndex: Integer);
procedure InsertionSortLogNodes(APLeftItem: PMemoryLogNodes; ARightIndex: Integer);
The text was updated successfully, but these errors were encountered: