Will Smith had a hard time dealing with his first breakup and he ended up using sex as a coping mechanism. The actor shared his experience and memories in a new memoir titled, "Will," which was released earlier this month.

In the memoir, Smith revealed that he turned to “rampant sexual intercourse” after his first relationship with a girl named Melanie came to an end when he was 16, according to Independent. “I desperately need relief but as there is no pill for heartbreak,” he wrote. “I resorted to the homeopathic remedies of shopping and rampant sexual intercourse.”

Smith shared that Melanie had a disturbing childhood. She lived with her aunt because he mother was in prison for killing her father. But after she had a fight with her aunt, she was kicked out of the only place she had to call home, but Smith convinced his parents to take her in, Buzzfeed News reported.

In his memoir, Smith writes that from the time he first laid his eyes on Melanie, she became “the center” of his life, and he became preoccupied with “healing the pain of her trauma.”

“The look in Melanie's eyes became the substitute for Gigi's [his grandmother’s] approval. I've always needed a woman to achieve for,” he writes in the book.

He said that their relationship came to an unfortunate end when he found out that she had cheated on him when he was away for a two-week music tour. Smith, in the memoir, says that up until that point in his life he “had only had sex with one woman other than Melanie.”

will smith
Actor Will Smith attends the Centerpiece Gala Premiere of Columbia Pictures' "Concussion" during AFI FEST 2015 presented by Audi at TCL Chinese Theatre on Nov. 10, 2015 in Hollywood, California. Kevin Winter/Getty Images for AFI

“Over the next few months, I went full ghetto hyena,” Smith writes. “I had sex with so many women, and it was so constitutionally disagreeable to the core of my being, that I developed a psychosomatic reaction to having an orgasm.”

Smith said that sex “would literally make me gag and sometimes even vomit”. He tried to heal himself from the pain of being cheated on, but in vain. “In every case, though, I hoped to God this beautiful stranger would be ‘the one’ who would love me, who would make this pain go away.”

However, Smith and Melanie reconciled, but it didn't last too long, and they broke up for good. There was a time of “resentment, rage, and destruction” around their split, where he collected all the things he’d ever bought for her and set them on fire while she watched.

In his memoir, he also talks about his marriage and children. It is currently available for purchase.