Can a Linux environment be PCI compliant if the swap partition/file is not encrypted and PANs are loaded into RAM by an application?
PCI compliance covers a lot of ground - anything that "stores", "processes" or "transmits" cardholder data.
Different systems need to have different parts of the standard applied to them to maintain a cohesive whole. Your system would fall into the "processes" category. Your needs would be different for storage, etc.
In the case you have outlined you can accomplish the protection of cardholder data written to disk in two distinct fashions. Either locking the pages holding cardholder data in RAM, encrypting the swap file, or both.
A third less desirable option is totally disabling the swap file.
As true as all this is you seem to be missing the big picture - PCI compliance doesn't come from just keeping the credit card information in RAM.
There are a lot of other things that you need to consider, even if you are only handling cardholder data in RAM. Central logging, HIDS, NIDS, etc.