The Crystal Programming Language Forum

Memory reporting

Not really an issue or anything just interested in why the memory is reported like this.
As far as I can tell the application is using 42.6m + 3.7m however the virtual memory is reporting 5035.2m (total OS + apps is only using 3Gb of memory)

Seems to scale almost linearly with an instance of a very complex class - I assume it’ll hit a limit before any physical resources are met so just wondering if it’s something I can prevent or code around? Or is this a non-issue?

1 instance of the class in the process reports ~100mb
55 instances in the one process is reporting ~5000mb

not leaking memory or anything

I think this is a thing in linux memory management, whereas it does not neccessarily allocate memory for something, if it is a copy of something else.

This is called copy on write, and as far as I know linux makes a lot of use of it.
If I understand the theory correctly, the memory is only freshly allocated if it is actually changed. As long as its content stay the same, the new copy just refereces the old loccation.

This is the Virtual memory footprint of a process.

Someone please correct me if I’m wrong :)