@@ -164,55 +164,20 @@ get_memory_calculation_strategy() ->
164
164
rss
165
165
end .
166
166
167
+ % % Win32 Note: 3.6.12 shipped with code that used wmic.exe to get the
168
+ % % WorkingSetSize value for the running erl.exe process. Unfortunately
169
+ % % even with a moderate invocation rate of 1 ops/second that uses more
170
+ % % CPU resources than some Windows users are willing to tolerate.
171
+ % % See rabbitmq/rabbitmq-server#1343 and rabbitmq/rabbitmq-common#224
172
+ % % for details.
167
173
-spec get_system_process_resident_memory () -> {ok , Bytes :: integer ()} | {error , term ()}.
168
174
get_system_process_resident_memory () ->
169
175
try
170
- get_system_process_resident_memory ( os : type ())
176
+ { ok , recon_alloc : memory ( allocated )}
171
177
catch _ :Error ->
172
178
{error , {" Failed to get process resident memory" , Error }}
173
179
end .
174
180
175
- get_system_process_resident_memory ({unix ,darwin }) ->
176
- get_ps_memory ();
177
-
178
- get_system_process_resident_memory ({unix , linux }) ->
179
- get_ps_memory ();
180
-
181
- get_system_process_resident_memory ({unix ,freebsd }) ->
182
- get_ps_memory ();
183
-
184
- get_system_process_resident_memory ({unix ,openbsd }) ->
185
- get_ps_memory ();
186
-
187
- get_system_process_resident_memory ({win32 ,_OSname }) ->
188
- % % Note: 3.6.12 shipped with code that used wmic.exe to get the
189
- % % WorkingSetSize value for the running erl.exe process. Unfortunately
190
- % % even with a moderate invocation rate of 1 ops/second that uses more
191
- % % CPU resources than some Windows users are willing to tolerate.
192
- % % See rabbitmq/rabbitmq-server#1343 and rabbitmq/rabbitmq-common#224
193
- % % for details.
194
- {ok , recon_alloc :memory (allocated )};
195
-
196
- get_system_process_resident_memory ({unix , sunos }) ->
197
- get_ps_memory ();
198
-
199
- get_system_process_resident_memory ({unix , aix }) ->
200
- get_ps_memory ();
201
-
202
- get_system_process_resident_memory (_OsType ) ->
203
- {error , not_implemented_for_os }.
204
-
205
- get_ps_memory () ->
206
- OsPid = os :getpid (),
207
- Cmd = " ps -p " ++ OsPid ++ " -o rss=" ,
208
- CmdOutput = os :cmd (Cmd ),
209
- case re :run (CmdOutput , " [0-9]+" , [{capture , first , list }]) of
210
- {match , [Match ]} ->
211
- {ok , list_to_integer (Match ) * 1024 };
212
- _ ->
213
- {error , {unexpected_output_from_command , Cmd , CmdOutput }}
214
- end .
215
-
216
181
% %----------------------------------------------------------------------------
217
182
% % gen_server callbacks
218
183
% %----------------------------------------------------------------------------
0 commit comments