Memories pop up in the strangest of places. Sometimes they're not even sure how they got there. Seems impossible that they even could be there. But there they are all the same.

One of the key moments in David Lowery's A Ghost Story floats by in the sound mix almost imperceptibly. It's the tune of a song, hummed by a little girl playing outside in the grass. It's a song we already know well by this point - enough to know it's temporally impossible for her to have ever heard it. But there it is, the hum of its melody dancing quietly through the breeze.

Then again: If we think about it a bit further, we consider that maybe it's the other way around, and maybe it was her song all along, and maybe it was, in fact, the genesis of that song we know so well. The film's conception of memory works both backward and forward, through time and space, and its ghost - who is, or was, a thirtysomething man billed only as C (Casey Affleck) - follows suit. He's something of a physical embodiment of memory - either a memory itself or the very process of remembering, of the connections forged through sounds, images, places, shared memories, smells. (In this sense the film not coincidentally shares a kinship with Upstream Color, which Lowery edited.) Which makes it all the more devastating that he - it - is in the process of being forgotten. In life, he was a mild-mannered musician living in a semi-rural neighborhood in Texas with his wife, M (Rooney Mara). Their relationship was very close, but had grown somewhat contentious over her desire to leave their house, which he'd grown attached to - for sentimental reasons or otherwise - and had passive-aggressively resisted discussing. In death, he still doesn't want to leave. His attitude on the matter, if not his personality altogether, has remain unchanged, fatal car accident or no fatal car accident.

C's spectral presence - the meaning of it, the purpose for it - is clarified in an extended, impromptu monologue from a bearded hipster (played by Will Oldham) at a house party, which C finds himself invisibly drifting through long after the widowed M has left the house, at long last, behind. It's a monologue that genuinely could have been, if we didn't know any better, the raw footage of a pre-rotoscoped scene from Waking Life. It's that kind of speech. He sits around a table and pontificates fatalistically but thoughtfully about the idea of impermanence - about the sobering realization that no matter how profound an artistic creation, a personal experience, an idea, a memory, a discovery might be, the universe is eventually going to forget it. Will forget its intentions, its meaning, its context, and will eventually forget it altogether. It'll all disappear in time. What Oldham wonders aloud - with a mixture of resignation and buried hopefulness - is to what extent that guarantee of impermanence should matter. I was reminded of one of Philip Seymour Hoffman's lines from Charlie Kaufman's Synecdoche, New York: "We're all hurtling towards death, yet here we are for the moment, alive. Each of us knowing we're going to die, each of us secretly believing we won't."

There's a mixed effect to that speech and the scene as a whole. Thematically, it's didactic; philosophically, it's earnest but obvious - self-evidentiary logic simply taken to its conclusion. In execution, it's part heartfelt ramble, part smartest-guy-in-the-room, hipster-performer masturbation (the kind familiar to undergraduates everywhere), with his small but rapt audience willingly ignoring the entrancing rumble of the surrounding party to indulge him - to give him the floor for a few minutes as he attempts to impress and/or depress them. Then again, it's also a deeply self-conscious and even self-revealing speech, and in Oldham's tone of voice and body language you get the sense he doesn't want too many people listening; his self-consciousness about the limitations of his own high-minded ramblings make his words endearingly pure in their contemplative simplicity, rather than arrogant. And then, further, there's the fact that, self-serving and even trite as some of his thoughts may be, he's not exactly wrong, either - and his thought process isn't exactly unfamiliar. Dwell too long on the idea of impermanence or, worse, nonexistence - both far more frightening existential ideas than, say, damnation - and it's not hard to arrive at some of the same conclusions, even if only in passing. "Even the Mona Lisa's falling apart," as another amateur pseudo-philosopher might say.

So: Death, then. And being forgotten. C rises from his hospital deathbed and returns - draped, in a gesture of comic earnestness, in a white sheet with the eyeholes cut out, the childlike regression of that image granting C, perhaps, a renewed innocence - and returns back to the house he shared with M, the house he never wanted to leave in the first place. His return is more instinct than determination. And he's not exactly one of a kind, either. In an adjacent window at the house next door, another ghost - same sheet; same eyeholes; shorter, broader frame - appears, and calmly informs C that it's waiting for ... someone? It can't remember. It's been waiting a long time. C - and, presumably, his neighbor, and anyone else stuck in this open-ended limbo - mostly waits and watches. The "haunting" parts of the gig - smashing dishes, knocking over household items, fiddling with the lights - don't usually do much good.

So he floats. Waiting and watching, as his memory fades and he, as a memory, fades away in kind. Time passes rapidly. M leaves the house, and a new family moves in. And then another. There are moments of anxious devastation - like when she brings another man home for the first time after C's death. He knocks a shelf full of books to the floor, as if to remind her of himself. She picks up Virginia Woolf's A Haunted House, which also lends the film its opening title card and which seems to be both a narrative and thematic inspiration for the film. Later, when a single mother and her two children have taken up residence, he stages a tirade. His behavior doesn't suggest fury so much as confusion - as if he's not sure who these people are, or why they're here, or even who, or when, he is. Or ... wait, wasn't he waiting for someone? A woman? What was her name? What did she look like?

Not that M left no trace. Before moving out for good, she wrote a tiny note, folded it up and stuck it inside a crevice in a wall that she quickly painted over. Something for the house - or the world, or a ghost - to remember her by. As time passes we see C scratching at the corners of the wall, trying to get to it - Lowery's version of Woolf's buried treasure. Whether, after a while, C even knows what he's searching for is unclear. Ghosts in ghost stories are usually defined by, and consumed with, their unfinished business, and usually that business is very specific. Here, the objective is more ethereal, elusive.

Simple as it is in concept, C's ghost is a striking, even beautiful figure; when it first emerges and heads home, we get a wide shot of it walking, with a calm and deliberate pace, across a grassy field at daybreak, the white sheet gliding behind like the train of a wedding dress. As the film goes along, the sheet dirties and crumples, as if C, even as a ghost, is aging; the eyeholes, which start as perfect, tight circles, begin to droop. Even his body language becomes sadder, older, lonelier. (Note Affleck's work here as one of two strong performances this summer somewhat overlooked simply because of their perceived lack of visibility - the other being Tom Hardy in Dunkirk.)

There's such intimacy and sorrow in the way Lowery frames his bodies (wrapped in sheets or otherwise). Two early shots of C and M gently demonstrate their emotional closeness; they cradle each other - in bed in one scene; on the living-room couch in another - barely moving; the long, unbroken shots - framed in the 1.33:1 ratio with rounded corners, a treasured old family photo of a movie - matches their warmth in the way they cradle the couple. Once C has died, Lowery engulfs his compositions with their very physical separation. One observes the other from across the room and diagonally across the frame; one is in focus and one is out; we observe their distance. The space between the two physical figures makes Mara's grief all the more painful. When she finally leaves him and his ghost and his house behind, there's all the more emptiness to envelop C. That space will be filled, too - and as time passes more and more rapidly, the film presents reasonably familiar (if uncommonly gorgeous) imagery as a surreal experience, as C hovers persistently through these same physical surroundings that he can make less and less sense of.

Watching this movie, you get the sense that Lowery mainlined Jauja (2015's best film), The Tree of Life (2011's best film) and Interstellar (Christopher Nolan's best film) in preparation for it, or in the midst of writing it. And while, not long ago (in my review of The Discovery), I took the piss out of movies like this - the soft, romantic, time-and-space-spanning headtrip - here's an example of one by a filmmaker with a firm command of his intentions. What he gets across with his visual rhymes and juxtapositions (one brief sequence of identical shots over time is particularly haunting, and has a Soderberghian precision to it) is remarkable in its impact and effortless in its simplicity.

A Ghost Story ultimately comes down to two people, and the one place that connected them, but the way Lowery connects those people - to each other, and to that place - extends far beyond them.

We know that smell is the sense most closely linked with memory - and with specific memories. Cinema doesn't have that resource (thank God); instead, it's music that seems to be the movies' best alternative. If so, Lowery's pairing of two obviously linked moments puts a nice, fine point on it: First, when Affleck's character, having just completed his new song, plays it for Mara's character for the first time. Headphones envelop her ears and the music washes over them and over the film's soundtrack. Then: Some time later, a grieving M lies on the floor, buds in her ears, listening to that same song, as we hear only that muffled, tinny shadow of it bleeding through the plastic. We cut back and forth between the two moments; the scene reaches its peak as M, on that hardwood floor, eyes dulled and distant, absentmindedly reaches her hand across the floor behind her head and rests it just in front of C, the ghost, a physical embodiment of the memory she's currently hearing, and feeling, but cannot see. It's a simply conceived but immaculately executed sequence, connecting the remembrance of the song to the moment of its provenance. The song isn't just the song, or that first moment of hearing it; the song is the person, and the relationship, and the house they shared, and the arguments they had, and the death that separated them.

It's the same song we hear that little girl hum later on. Its unexpected, even inexplicable, presence in her voice holds bountiful mysteries; but it also makes a clear sort of sense. The film, and its characters, question the way people attempt to be remembered, or if they can be at all. It touches on the idea of collective consciousness - ideas and memories and words and creations as charges on an electrical current. In writing his song, maybe C is remembering the residue of someone else's memory; or maybe that little girl is remembering the residue of his. Maybe that person, that feeling, that creation, that intangible something that's lost, missing, forgotten, dead ... may have survived after all. Maybe that's what ghosts are.