(CNN) Garry Shandling, the comedian whose TV shows "The Larry Sanders Show" and "It's Garry Shandling's Show" parodied talk shows and sitcoms with reflexive, absurdist comedy, has died. He was 66.

Shandling's publicist, Alan Nierob, told CNN that Shandling died of an apparent heart attack.

Los Angeles Police Department Officer Rosario Herrera confirmed his death Thursday afternoon. Paramedics responded to a medical emergency and took Shandling to a hospital, where he died, according to Officer Aaeron Jefferson.

Shandling became a hero to a generation of comedians for his self-aware comedy and groundbreaking shows.

"RIP the great Garry Shandling. Surely, one of the most influential comedians of a generation," tweeted Ricky Gervais.

"Garry Shandling was a very special comedian with a beautifully unpredictable mind. He even voluntarily offered jokes and ideas for Oscars," tweeted Steve Martin.

RIP the great Garry Shandling. Surely, one of the most influential comedians of a generation. — Ricky Gervais (@rickygervais) March 24, 2016

Garry Shandling was a very special comedian with a beautifully unpredictable mind. He even voluntarily offered jokes and ideas for Oscars. — Steve Martin (@SteveMartinToGo) March 24, 2016

Director Judd Apatow, who credits Shandling with his break in show business, was heartbroken by Shandling's death.

"I just don't know how to sum up someone I loved so much who taught me everything I know and was always so kind to me. I am just too sad," he said in an email to The Wrap

The former advertising man got his start in entertainment as a writer for "Sanford and Son." By the early '80s he was a successful standup comedian and a regular on late-night talk shows. His persona -- full of angst and uncertainty, like a sorrowful puppy dog -- played up his lack of success with women and embarrassment at his foibles.

"I'm dating a woman now who, evidently, is unaware of it," went one of his lines.

In 1985, he and former "Saturday Night Live" writer Alan Zweibel launched "It's Garry Shandling's Show," a sitcom on the Showtime network. On it, Shandling played Garry Shandling, a comedian living in Sherman Oaks, California, much like the real-life Shandling.

At a time when sitcoms were fairly straightforward three-camera affairs about families and workplaces, "Shandling's Show" made no bones about being a fictional construct. The theme song talked about being a theme song ("This is the theme to Garry's show, the opening theme to Garry's show, this is the music that you hear as you watch the credits"). One early episode neatly, and self-consciously, sent up the film "The Graduate."

And Shandling and other characters would regularly break the fourth wall to talk to the audience. It was a routine that dated back to George Burns, but in Shandling's hands it seemed fresh.

Shandling also did a "25th Anniversary Special," parodying late-night talk shows -- particularly Johnny Carson's "Tonight Show," which dominated late night of the era.

"It's Garry Shandling's Show" ran for four seasons. Two seasons were picked up by the then-fledgling Fox network.

Shandling followed that sitcom with a show hailed as one of the great comedies in TV history, "The Larry Sanders Show," in which Shandling played the titular host.

The program, which aired on HBO, used the late-night wars of Jay Leno and David Letterman as a starting point, but went much deeper: It satirized sycophantic sidekicks in Jeffrey Tambor's "Hey Now" Hank Kingsley, overbearing producers in Rip Torn's Artie, not to mention backbiting writers and two-faced celebrity guests.

In one extended riff, Shandling's Sanders was convinced that David Duchovny had sexual feelings for him.

The show's other stars included Jeremy Piven, Janeane Garofalo, Sarah Silverman and Bob Odenkirk. Apatow and "Rescue Me" creator Peter Tolan were among the show's writers.

Other performers talked about him with awe. Robert Downey Jr. compared him to "a Jewish E.T."

And Apatow told GQ in 2010, "There's nobody better in the world than Garry at telling me what's working and what's not. I'm just very lucky that I've had his input."

R.I.P. Garry Shandling. I am so saddened to hear this. Brilliantly funny and such a great guy. He will be so missed. — Albert Brooks (@AlbertBrooks) March 24, 2016

Garry Shandling was as kind and generous as he was funny and that is saying a lot. — Jimmy Kimmel (@jimmykimmel) March 24, 2016

Goodbye Gary Shandling thank you for your kindness and your generosity and for making me laugh so damn much — Amy Schumer (@amyschumer) March 24, 2016

Sunday, my longtime friend Garry Shandling was here, making every1 laugh. I loved him. I'll miss our talks the most. pic.twitter.com/Ud8AQXNBXN — Kathy Griffin (@kathygriffin) March 24, 2016

In its six seasons, "The Larry Sanders Show" won three Emmys and was nominated for more than four dozen more. It also won two Peabody Awards and was hailed by TV Guide as one of the 50 greatest shows of all time. Its reputation helped establish HBO as a venue for cutting-edge original programming.

In recent years, Shandling had appeared in a variety of movies, including "Iron Man 2" and "Captain America: The Winter Soldier" as a U.S. senator.

He was the guest in a now-poignant episode of Jerry Seinfeld's "Comedians in Cars Getting Coffee," in which the two discussed the shock of Robin Williams' death and the perils of getting older. The episode, called "It's Great That Garry's Shandling's Still Alive," concludes with Shandling talking about a insistent medical worker who's glad that he hadn't passed away.

But even then, he got laughs from the situation.

Indeed, he never gave up comedy. Always fond of absurdity, he told GQ six years ago that he was working on a new act.

"The direction I'm going in is eventually you won't know if it's a joke or not," he said. "What I want to happen is that I talk for an hour and the audience doesn't realize it is funny until they're driving home."