I want to show RAM usage of BBB while it is working. Is there any way to determine RAM usage of a BBB? Do you have a sample code for this?
You can review code from utilities top or htop. Sources are open
You can do as Maxim suggests, or you can open another terminal( ssh session ), and run the command free periodically. Personally, I use both free and atop. atop is also a good way of casually profiling the system while running tests.