Monitor memory

Suppose our application limit use for up to 20GB of data. How to monitor the usage?

Do we need to consider swap?

Thanks.

What that program considers data would be a question to ask that program's vendor.

The question is not clear.

Are you trying to limit memory use on an application that you are using, but did not write?
Or are you trying to limit memory use on an application you are developing?
Or are you not trying to limit anything, but just wanting to know how much memory is used?

Also, AFAIK, swap is either on or off at the system level, not on an application basis.