Jennette McCurdy kept a dark secret while starring in the hit series "iCarly" and its spinoff "Sam and Cat."

On Thursday, the actress revealed she battled eating disorders for years, including anorexia, binge eating and bulimia.

"I was a mess for a long time," the 29-year-old told People magazine. "But I no longer think about food in an obsessive way. And I once didn’t believe that was ever possible."

According to the outlet, McCurdy was 11 years old when she was introduced to restrictive eating by her mother Debbie. McCurdy claimed that the matriarch abused her physically and mentally. The former child star has an upcoming memoir in the works that will detail those struggles.

'ICARLY' STAR JENNETTE MCCURDY RECALLS PHYSICAL, EMOTIONAL ABUSE FROM MOTHER DURING CHILDHOOD

Jennette McCurdy

Jennette McCurdy is planning on releasing a memoir that will detail her struggles. (Photo by George Pimentel/WireImage/Getty Images)

"My mom said she could teach me calorie counting and we could be a team, but that I had to keep it a secret," McCurdy alleged. "I thought it was an opportunity for my mom and me to be closer."

McCurdy said that at one point she was living on 1,000 calories a day and "sometimes I’d eat even less because I wanted my mom to be proud." The outlet shared that by the time she was cast on "iCarly" McCurdy had anorexia.

McCurdy said no one on set knew she was privately battling the disorder.

"Ironically, my character’s trademark is that she loves food," McCurdy reflected. "I’d have scenes where I was supposed to be eating and they’d have a spit bucket. But I’d have terror that there would still be calories left in my body."

When McCurdy turned 18, Debbie was diagnosed with cancer for the second time. That’s when she "swung to binge eating" and "would eat everything in sight."

CLICK HERE TO SIGN UP FOR THE ENTERTAINMENT NEWSLETTER

iCarly

‘iCarly’ cast members (from left) Noah Munck,  Miranda Cosgrove, Jerry Trainor, Jeanette McCurdy and Nathan Kress, circa 2012. (Photo by Paul Morigi/Getty Images for Nickelodeon)

The matriarch passed away in 2013. McCurdy said she began purging to cope with her mother’s death and would vomit "up to 10 times a day."

"Bulimia took over my life very quickly," she said. "… It was a full-time job, so there was no space to deal with the issues or mourning my mom."

McCurdy was in co-star Miranda Cosgrove’s bathroom when she passed out from purging. That experience left her shaken.

"… I could have died, choking on my own vomit," she said.

The outlet also revealed that at one point, McCurdy lost a tooth after its enamel was worn by stomach acids from purging. That incident took place in an airplane bathroom. McCurdy knew she needed help.

CLICK HERE TO GET THE FOX NEWS APP

Jennette McCurdy eating disorder

Jennette McCurdy said food is no longer her coping mechanism. (Photo by Steve Granitz/WireImage/Getty Images)

McCurdy credited two years of intensive Dialectical Behavior Therapy (DBT) to help her not only face the eating disorders, but also her mother’s death. Today, she said food is no longer her coping mechanism.

"I haven’t binged or purged or restricted in years," she said. "And I feel very deeply and very strongly about saying I’ve finally recovered."