If there's one thing Heath MacMillan knows a thing or two about, it's how to kill a fruit fly.

The Carleton University biology professor has been cooling down the tiny pests in an attempt to figure out what causes them to become injured and then die.

It may seem gruesome, but according to MacMillan, it's work that — as the planet's climate continues to change, becoming warmer overall but also fluctuating more — could be vital.

"The climate is warming, and because of that actually we are already seeing a lot of insects changing their distribution," he says. "We're interested in the long haul in understanding what those patterns are going to be and trying to determine whether or not we can predict where animals might be in the future.

"The common misconception with climate change is that everything is going to get warmer. That is one consequence of climate change ... but one of the other major predictions of climate change is that we're also going to end up with a lot more variability of temperature."

One of two things could happen: either the temperature thresholds of animals will be crossed more often, or they'll adapt. MacMillan's team wants to find out which, and why. Their research appeared last week in the journal Scientific Reports.

Locusts are next on the testing list.

Tips for getting rid of fruit flies

While the research may not apply to anyone currently dealing with a fruit fly invasion, MacMillan says that when you work in a fruit fly laboratory, you learn a few tricks.

"One option is that they don't like being chilled very much. You can certainly put them into your freezer and they're not going to survive for very long," he says.

He recommends placing ripe and rotting fruit in a container with some apple cider vinegar. Cover the opening with plastic wrap, poke some small holes in it, and the fruit flies will be drawn to the yeast inside.

When you've caught enough fruit flies, place the container in the freezer for a couple hours to kill them.