People are free to choose what they want but you mainly keep only the "main" surname from each parent.
I know in England there was a tendency of people keeping both names of powerful families[1][2], then as double-barreled surnames. Which then sometimes went a bit nuts a few generations later if they married into other double-barreled families [3].
I think it was when I visited Stowe School, the seat of the Dukes of Buckingham and looked at the family tree, that I even saw some surnames repeated if they married into other families which shared one of their multi-barreled surnames...