MCPcopy Create free account
hub / github.com/apache/impala / GetProcessVMSize

Method GetProcessVMSize

be/src/runtime/client-cache-test.cc:64–83  ·  view source on GitHub ↗

Return the virtual memory size that the process is using. Only works for Linux.

Source from the content-addressed store, hash-verified

62 // Return the virtual memory size that the process is using.
63 // Only works for Linux.
64 uint64_t GetProcessVMSize() {
65 // vm size, https://man7.org/linux/man-pages/man5/proc.5.html
66 const int vm_size_pos = 22;
67 ifstream stream("/proc/self/stat");
68 string line;
69 string space_delimiter = " ";
70 vector<string> words{};
71 if (getline(stream, line)) {
72 size_t pos = 0;
73 while ((pos = line.find(space_delimiter)) != string::npos) {
74 words.push_back(line.substr(0, pos));
75 line.erase(0, pos + space_delimiter.length());
76 }
77 }
78 uint64_t value = 0;
79 if (words.size() <= vm_size_pos) return value;
80 istringstream iss(words[vm_size_pos]);
81 iss >> value;
82 return value;
83 }
84};
85
86// Testcase for IMPALA-11176 to verify the memory leak issue.

Callers

nothing calls this directly

Calls 6

push_backMethod · 0.80
substrMethod · 0.80
eraseMethod · 0.80
findMethod · 0.45
lengthMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected