When a process is created in linux an area of memory is mapped for said process. The memory consists of the amount of space for the program itself (aka the code), the heap (aka the data), and the stack (where the local variables for a single procedure and return values and such get stored). This is all "virtual" address space. It is not necessarily contiguous in memory and might not reside in actual physical memory. The other thing you have to be aware of.... if a program dynamically allocates a large piece of memory and frees it you might not see an immediate reduction in the total memory usage for the process. Linux takes the "lazy" approach to freeing memory. When you free memory it makes a note that it is free but doesn't actually do anything about it until something else needs that memory.
It is hard to get more specific without going into an amount of detail you probably don't care to know.