IMPORTANCE: Marijuana use is increasingly common in the United States. It is unclear whether it has long-term effects on memory and other domains of cognitive function. OBJECTIVE: To study the association between cumulative lifetime exposure to marijuana use and cognitive performance in middle age. DESIGN, SETTING, AND PARTICIPANTS: We used data from the Coronary Artery Risk Development in Young Adults (CARDIA) study, a cohort of 5115 black and white men and women aged 18 to 30 years at baseline from March 25, 1985, to June 7, 1986 (year 0), and followed up over 25 years from June 7, 1986, to August 31, 2011, to estimate cumulative years of exposure to marijuana (1 year = 365 days of marijuana use) using repeated measures and to assess associations with cognitive function at year 25. Linear regression was used to adjust for demographic factors, cardiovascular risk factors, tobacco smoking, use of alcohol and illicit drugs, physical activity, depression, and results of the mirror star tracing test (a measure of cognitive function) at year 2. Data analysis was conducted from June 7, 1986, to August 31, 2011. MAIN OUTCOMESAND MEASURES: Three domains of cognitive function were assessed at year 25 using the Rey Auditory Verbal Learning Test (verbal memory), the Digit Symbol Substitution Test (processing speed), and the Stroop Interference Test (executive function). RESULTS: Among 3385 participants with cognitive function measurements at the year 25 visit, 2852 (84.3%) reported past marijuana use, but only 392 (11.6%) continued to use marijuana into middle age. Current use of marijuana was associated with worse verbal memory and processing speed; cumulative lifetime exposure was associated with worse performance in all 3 domains of cognitive function. After excluding current users and adjusting for potential confounders, cumulative lifetime exposure to marijuana remained significantly associated with worse verbal memory. For each 5 years of past exposure, verbal memory was 0.13 standardized units lower (95% CI, -0.24 to -0.02; P =.02), corresponding to a mean of 1 of 2 participants remembering 1 word fewer from a list of 15 words for every 5 years of use. After adjustment, we found no associations with lower executive function (-0.03 [95% CI, -0.12 to 0.07]; P =.56) or processing speed (-0.04 [95% CI, -0.16 to 0.08]; P =.51). CONCLUSIONS AND RELEVANCE: Past exposure to marijuana is associated with worse verbal memory but does not appear to affect other domains of cognitive function.