The "squeeze memory" action statement can recover all of the small, effectively unusable segments of memory wedged between other currently used areas. It does this by walking through memory and sequentially processing each segment of memory. As it finds an unused segment of memory, it continues along until it finds the beginning of the next segment in use, then byte-by-byte relocates this segment so that it is now adjacent to the last segment, thereby "compressing" all of the unused space out.
If you are familiar with hard disk optimization programs, this is exactly the same sort of problem they solve, and exactly the same sort of approach they use to solve the problem. During the squeeze memory process, an adjustment table is built, to enable internal addresses to be changed to point to the relocated memory. Depending on the amount of fragmentation, this adjustment table can become quite large, therefore it is possible to run out of memory during a squeeze.