Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Memory management question
Memory management question [message #58064] Fri, 04 February 2022 02:12 Go to next message
zsolt is currently offline  zsolt
Messages: 696
Registered: December 2005
Location: Budapest, Hungary
Contributor
I have a HTTP server app, and after some running, I can see a huge (1.2 GB) virtual memory usage, but the physical memory usage is at a normal level (10 MB).
The output of ps command:
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME
www-data 2769421  0.0  0.4 1210720 10156 ?       Ssl   2021  22:10


The output of the free command seems to be OK:
              total        used        free      shared  buff/cache   available
Mem:        2035160      292508      292132       55176     1450520     1499604
Swap:       1048572        6500     1042072


Is that normal, or I have some memory leak?
What can be the cause of it?

[Updated on: Fri, 04 February 2022 02:14]

Report message to a moderator

Re: Memory management question [message #58075 is a reply to message #58064] Tue, 08 February 2022 00:16 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
zsolt wrote on Fri, 04 February 2022 02:12
I have a HTTP server app, and after some running, I can see a huge (1.2 GB) virtual memory usage, but the physical memory usage is at a normal level (10 MB).
The output of ps command:
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME
www-data 2769421  0.0  0.4 1210720 10156 ?       Ssl   2021  22:10


The output of the free command seems to be OK:
              total        used        free      shared  buff/cache   available
Mem:        2035160      292508      292132       55176     1450520     1499604
Swap:       1048572        6500     1042072


Is that normal, or I have some memory leak?
What can be the cause of it?


It can be leak, it can be fragmentation.

I suggest dumping MemoryProfile from time to time to find out.

Does it grow from 1.2G further? What is "some running"? Hours, days, weeks, how many requests?

Mirek
Re: Memory management question [message #58076 is a reply to message #58075] Tue, 08 February 2022 01:21 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 696
Registered: December 2005
Location: Budapest, Hungary
Contributor
Thanks for suggesting MemoryProfile, I didn't know about it.
I will start using it.

I started the daemon 2 months 23 days ago.
The total running time was that 22 minutes (ps output), serving about 104 thousand requests since the starting.
The virtual memory usage did not grow since my original post, but there was not too much traffic since that time.

This is an HTTP server using CoWork for MT, serving JSON and PDF output to HTTP GET requests and HTTP JSON POSTs. It uses PostgreSQL as backend.

This is my first project, where I use a lot of exceptions in error handling and complex structures as return values. Maybe one of them can be the problem, causing fragmentation.

I will try to find out something.

Thanks a lot.
Re: Memory management question [message #58077 is a reply to message #58076] Tue, 08 February 2022 04:30 Go to previous message
zsolt is currently offline  zsolt
Messages: 696
Registered: December 2005
Location: Budapest, Hungary
Contributor
Sorry for this silly question Embarassed

I have read some Linux docs.
VSZ is the sum of used memory of all threads (the process + shared libraries).
So in a multi threaded app it can be a huge number.
Previous Topic: CvFlt.cpp does not compile with MSBT__x64
Next Topic: How do I deserialize grouped items into an array or map when they take this form? [solved]
Goto Forum:
  


Current Time: Fri Apr 19 22:43:54 CEST 2024

Total time taken to generate the page: 0.02518 seconds