This guide explains what MW’s suggested spacetop command does and how to run it to identify which trees/objects generate the most changes — often the root cause of Android OOM during sync.

What spacetop is for

spacetop scans the local spaceStore database(s) and shows the top trees by number of changes.
This is useful for Android OOM investigations because OOM often happens when:
one or a few trees have huge TOTAL changes (heavy history), and/or
some trees have very high RECENT changes (very “hot”), so syncing pulls a lot and memory spikes.
If you run it with --since, spacetop shows both:
TOTAL CHANGES (all-time)
RECENT CHANGES (within the time window)
and it sorts by RECENT CHANGES.

Step-by-step: Install and run

1) Install the tool

go install github.com/anyproto/any-sync-tools/spacetop@latest
This installs spacetop into your Go bin folder (typically ~/go/bin).
Verify it works:
spacetop --help
If you get command not found, add ~/go/bin to your PATH.

2) Find the correct spaceStoreNew path

You need the Anytype local account folder and then:
.../spaceStoreNew
Example:
/Users/<user>/Library/Application Support/anytype/alpha/data/<ACCOUNT_ID>/spaceStoreNew
spacetop expects this structure:
spaceStoreNew/<SPACE_ID>/store.db
For the object “details view” to work properly, it also expects:
../objectstore/<SPACE_ID>/objects.db

3) Run MW’s command (exact example)

spacetop -p /Users/roman/Library/Application\ Support/anytype/alpha/data/AASdKiEGfcyhxX3ufr4auHRviACUXxkF68uZwtSb2AnyRoMA/spaceStoreNew --since 240h -n 50
Meaning:
-p ... → path to spaceStoreNew
--since 240h → last 10 days (240 hours)
-n 50 → show top 50 trees

How to interpret the output

Case A: running with --since

You will see columns like:
TOTAL CHANGES → total change history for this tree
RECENT CHANGES → changes within the --since window
The table is sorted by RECENT CHANGES, so the first rows are the hottest trees.
✅ OOM suspects are usually:
trees with very high RECENT CHANGES
OR trees with very high TOTAL CHANGES (even if RECENT is low)

Case B: running without --since

You’ll see a single column:
CHANGES → all-time changes count
Useful for finding “legacy monsters” (trees with huge historical change count):
spacetop -p ".../spaceStoreNew" -n 50

How to estimate “how many changes the user has in the account”

Important nuance: spacetop does not directly print one single “total changes across the entire account” number by default.
It’s designed to surface the top heavy trees, since those are usually the real memory issue.
Still, you can get closer to a full picture:

Option 1: show all trees

spacetop -p ".../spaceStoreNew" --top 0
--top 0 means “show everything” (no top limit).
⚠️ On huge spaces, this may produce a lot of output.

Option 2: check one specific space only

If you know the space-id:
spacetop -p ".../spaceStoreNew" --space-id <SPACE_ID> -n 50
This isolates whether the issue is mainly inside:
one large space (often the “main huge space”)
or multiple spaces

Best practical workflow for OOM debugging

Step 1: find “hot sync” trees

spacetop -p ".../spaceStoreNew" --since 24h -n 50
Focus on the top rows (high RECENT CHANGES).

Step 2: find “huge history” trees

spacetop -p ".../spaceStoreNew" -n 50
This highlights the biggest trees by total CHANGES.

Step 3: inspect top entries (identify the object)

In spacetop, press Enter on a row to see details such as:
object name
layout
object JSON
This helps you understand what it is (channel, collection, etc.).

What usually indicates “this is likely causing OOM”

Red flags:
one tree has tens of thousands (or more) changes
multiple top entries belong to the same space (main space)
very high RECENT CHANGES within last 10 days → repeated sync spikes
object type looks “live / constantly updated” (e.g., chat/channel-like structures)

Next step

If you paste the top ~15–20 rows from spacetop --since 240h, it’s usually enough to spot the most suspicious trees and decide what to inspect next.