This depends on your local building code (if any), and the type of attic space your have. Live loads can range from 10 pounds per square foot for attics with limited height to 30 pounds per square foot for attics that can be accessed by fixed stairs. It is also dependent on the wood species used.
See pages 11 and 12 of the American Wood Council's "Span Tables for Joists and Rafters
". These table are found in the International Residential Code.
Kiln dried 2x4 spruce-pine-fir "could be" used at a 10' span with 10 psf live load at a spacing of 16" o.c., however that would be at the outer limits of the allowable span. As Joe stated you'll have more sag than if you framed using 2x6 or 2x8. I would probably recommend a 12" o.c. spacing should you decide on the 2x4's.
Again framing size and spacing is determined by the actual live load of the attic space and species of wood used.
Hope this helps! Good luck! :thumbsup: