It's all too easy to beat up on Wal-Mart (NYSE: WMT). But at times, the megaretailer can unquestionably use its size and power for benevolent ends. The company's gotten a lot of good press for its recent sustainability initiatives, and now it's taking a big step up in the battle against hunger.

Wal-Mart will increase its donations to food banks by the equivalent of $2 billion, spread out over the next five years. The lion's share of its anti-hunger effort will involve donating 1.1 billion pounds of food in its stores that might otherwise go to waste: the items many folks won't buy, or which can't be sold because they're close to their expiration date, for example.

Wal-Mart's donations will include fruits, vegetables, and meats, but its philanthropic effort also provides $250 million in grants for refrigerated trucks to better transport such items to food banks before they spoil.

Food waste is a big problem in the U.S. In 2008, the New York Times reported that 27% of the food available for consumption in homes, restaurants, and grocery stores went to waste. For obvious reasons, perishable goods like the ones Wal-Mart will donate present a particular problem.

Fortunately, the idea of donating food that would otherwise be wasted isn't new for Wal-Mart. Last year, the company shelled out $21 million for hunger relief, giving away 116.1 million pounds of food -- a significant gain on 2008 levels. For 2010, Wal-Mart has stepped up its commitment again.

Wal-Mart's not alone in its efforts. Supermarket chain Kroger (NYSE: KR) gave away 50 million pounds of food last year, and Panera Bread (Nasdaq: PNRA) gives its unsold baked goods to local food banks and charities at the end of each day. Whole Foods Market (Nasdaq: WFMI) also donates food to local food banks and charities. Safeway (NYSE: SWY) proclaims its support for America's Second Harvest, the leading network of food banks; the company says it has donated more than $1 billion worth of food over the past decade.

With high unemployment and other factors hurting many American families, the thought of perfectly good food doomed to rot in landfills is tragic. Wal-Mart shareholders should be glad to see the retail behemoth making common-sense efforts in troubled times.