computeCellDistance() in R/spatial.R (around line 556, SpatialCellChat v0.1.0) calls Rfast::Dist(coordinates) to compute a dense N×N pairwise distance matrix before thresholding it into a sparse matrix.
For high-resolution spatial data such as Visium HD 8µm bins, where N routinely exceeds 100K–400K cells, this dense matrix requires 244 GB (174K cells) to 1.6 TB (445K cells) of RAM, causing immediate OOM crashes on any standard machine.
Since the function ultimately only retains the small fraction of entries within interaction.range, the dense intermediate is unnecessary — a KD-tree nearest neighbor search (e.g., FNN::get.knnx) could construct the sparse distance matrix directly in O(N·K) memory (~0.2 GB), making SpatialCellChat feasible on Visium HD-scale datasets without downsampling.