fork() duplicates the whole process. The only difference is the return value of the fork() call itself - in the parent object it returns the child PID, in the child case it returns 0 .
Most operating systems optimize this using a method called copy on write. Instead of copying the entire memory, the child shares the parent memory. However, all memory pages are marked as "copy-on-write", which means that if any process modifies something on the page, it will be copied at this time, and the process that changed it will be changed to use copy (and the COW flag will also be disabled for the original page).
See Wikipedia for more details.
source share