Shares of memory chipmaker Micron (NASDAQ:MU) are down over 40% so far this year. The company sells DRAM and NAND chips; both are largely commodities, and prices are heavily dependent on supply and demand. Fears have been building throughout 2015 that DRAM prices would soon weaken, and now Gartner is predicting a very difficult pricing environment over the next two-and-a-half years. While Micron has posted record profits over the past 12 months, trouble may be right around the corner.

PCs are a problem
A little over 30% of Micron's DRAM business comes from the PC market, and the recent slump in PC sales is already doing a number on Micron's profits. During the company's latest quarter, the segment that includes memory chips that go into PCs and servers suffered a 46% decline in operating profit compared to the previous quarter. The segment's operating margin contracted by nearly 10 percentage points to 17.6%, with strong demand for server chips partially counteracting weak demand for PC chips.

The downturn in PC sales caught many PC-centric companies by surprise. Intel cut its capex plans for 2015 for the second time when it reported earnings recently, and AMD, after guiding for a profitable second half just a few months ago, now expects the second half to be unprofitable.

Gartner's latest outlook calls for oversupply to develop in the DRAM market in 2016, predicting a 17.4% and 7% decline in DRAM industry revenue during 2016 and 2017, respectively. With Micron forecasting DRAM supply bit growth in the low to mid-20% in 2016, this implies that DRAM price/bit will fall dramatically.

If these predictions hold up, the next few years could look a lot like the 2011-2012 period for Micron. The company's DRAM average selling price per bit fell by 39% and 45% in those two years, respectively, turning a record profit in 2010 into a $1 billion loss in 2012.

Smartphones may not save the day
While demand for PC DRAM is falling, the smartphone DRAM market is a different story. Micron's mobile segment grew during the company's latest quarter, and its operating margin expanded by one percentage point from the previous quarter, reaching a healthy 31.6%.

Smartphone shipments are still rising globally, albeit at a much slower rate than in the recent past, and the quantity of DRAM going into each smartphone is on the rise as well. But this growth in demand doesn't guarantee that Micron will be able to maintain its high levels of profitability in the mobile segment.

Micron is shifting capacity from weak areas, like PCs, to high-growth areas, like smart phones. This makes sense for Micron, but it also makes sense for the other two major DRAM manufacturers, Samsung and SK Hynix. In addition, both Samsung and SK Hynix are expanding their respective DRAM capacities over the next year as well. So while demand for mobile DRAM may be growing, supply is also growing. And with increased supply comes pricing pressure that could drive down Micron's margins.

Another problem is China. Smartphone sales in China declined year over year during the first quarter of 2015, the first decline in six years. China is a major smartphone market, with nearly 100 million smartphones sold during the first quarter alone, and a prolonged slump in demand could wreak havoc on mobile DRAM pricing.

A rough road ahead
Both DRAM oversupply and undersupply tend to work themselves out over time. Micron booked record profits in 2010, but oversupply plagued the industry over the next few years, a situation that Samsung predicted in late 2010. Micron saw its gross-margin collapse, falling from 32% in 2010 to just 11.8% in 2012, leading to a $1 billion loss.

Eventually, this period of oversupply ended, and Micron's profits recovered. Micron reached high levels of profitability in 2014, but the situation is now eerily similar to late 2010. The PC market is weak, capacity is being expanded, and Micron's profits have already started to take a hit.

These cycles of oversupply and undersupply are normal, and while the DRAM industry has consolidated in recent years, with just three major manufacturers remaining, this consolidation hasn't made Micron or its competitors immune from oversupply. All signs are pointing toward a very rough few years for Micron.

Timothy Green has no position in any stocks mentioned. The Motley Fool recommends Gartner and Intel. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.