Most memory tools tell you what is happening. memory_pressure goes the other way: it can apply real pressure to the system, or fake a low-memory state for a while.
The man page describes it as a tool to apply real or simulated memory pressure. The simulated form is the one I would start with:
memory_pressure -S -l warn -s 20
-l takes the level, either warn or critical. -S makes the tool simulate that level by placing the system at it artificially, and -s sets how long it holds that state, here 20 seconds. That is handy for seeing how an app reacts when the system reports low memory, without actually filling the RAM.
Without -S, -l applies real pressure until the low-memory notifications for that level are generated. There is also a percentage mode:
memory_pressure -p 20
That allocates memory until the available memory is 20 percent of the total. The man page adds that if the available percentage on the system drops, the tool frees memory until it reaches the target or has nothing left to free. In real-pressure mode, -s is the time to wait before allocating or freeing.
The caveat is that apps and the system react to these states. Save your work first, and I would not try the real modes on a Mac that is doing something important. The man page lists vm_stat under See Also, which is the tool to watch what happens to the counters in a second Terminal window.
Further reading: memory_pressure man page