"Separating from Ashton was just a nightmare for her. It took her years to get over it," says a source of Demi Moore's split from Ashton Kutcher

Demi Moore is opening up about the perils of love, loss and aging in Hollywood.

In her new memoir Inside Out, the actress, 56, writes about the emotional toll her relationship with and marriage to Ashton Kutcher took on her mental and physical health and heightened her existing insecurities about aging in Hollywood.

“It really played havoc with her self confidence,” says an industry source of Moore’s split from Kutcher, 41. “Demi was confused about her life and what direction her career would take as she got older.”

Moore and Kutcher began dating in 2003 after meeting at a dinner with mutual friends and were married from 2005-2013. According to The New York Times, the actress writes that early in their relationship she miscarried, at six months, and blamed herself. She says she started abusing Vicodin and alcohol as a coping mechanism. The deterioration of the relationship — revealed via their 2011 separation, in the midst of reports that Kutcher cheated on Moore — and eventual divorce in 2013 has taken “years” for Moore to get over.

USA - "The Twelfth Annual CFDA/Vogue Fashion Fund Awards" In New York
Demi Moore
| Credit: Lars Niki/Corbis/Getty
  • For much more on Demi Moore and her new memoir, pick up the latest issue of PEOPLE on newsstands Friday

“Separating from Ashton was just a nightmare for her. It took her years to get over it,” says the source. “She was always very insecure about their age difference and it was devastating that Ashton left her. She had so much self-blame and resentment towards herself after the split. She was really struggling mentally and didn’t take care of herself.”

The source adds that although it’s taken a long time, Moore is getting to a much healthier place.

“She really has changed a lot for the better in the past few years. You can tell that she is much happier and enjoys her life more,” the source says. “She goes to therapy and works on being a positive and kind person to herself.”

Charity Gala With Demi Moore And Ashton Kutcher - Private Dinner
Ashton Kutcher and Demi Moore
| Credit: Victor Boyko/GC/Getty

Writing the book, which is available Sept. 24, has been cathartic for Moore.

“She wanted to free herself of the trauma and heartbreak endured after her split from Ashton, but it was a struggle,” says an industry source. “Demi has been trying to improve her life, gain self-esteem and get healthy for several years. Spilling it all out in a personal memoir is a way to close the old door and open new ones.”

  • with reporting by LINDA MARX