We use two types of microcontrollers at the present time. Of course, megabytes or even hundreds of kilobytes are not usually possible. However, tens of kilobytes are easily obtained. We have found this to be sufficient for short rocket flights. Controlling the payload operation and sensors is their main function.
Balloon flights can be very long - many hours.
These little microcontrollers do not have the memory capacity necessary for such long flights. Of course, we could use more powerful controllers but a more reasonable solution is to immediately transmit the data to the ground using radio waves. I teach an Introduction to Microcontrollers in which I use a number of payload ideas as instructional projects for students to create and build in the class. The altimeter mentioned above was a project in that class. The Parallax web site has a large number of application notes that can be converted into projects for balloon or rockets or just as class projects.