Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SteelT
SRB2
Commits
4cb57092
Commit
4cb57092
authored
3 years ago
by
SteelT
Browse files
Options
Downloads
Patches
Plain Diff
Fix windows compiling
parent
9d36a8c0
Branches
refactor-mem-get
No related tags found
1 merge request
!4
Refactor getting memory usage a bit
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sdl/memstats.c
+9
-5
9 additions, 5 deletions
src/sdl/memstats.c
with
9 additions
and
5 deletions
src/sdl/memstats.c
+
9
−
5
View file @
4cb57092
...
...
@@ -15,6 +15,10 @@
#include
<errno.h>
#endif
#ifdef _WIN32
#include
<windows.h>
#endif
#ifdef __linux__
#include
<sys/types.h>
#define MEMINFO_FILE "/proc/meminfo"
...
...
@@ -22,7 +26,7 @@
#include
"memstats.h"
#ifdef __linux__
#ifdef __linux__
ssize_t
numread
;
int
meminfo_fd
=
-
1
;
long
Cached
;
...
...
@@ -111,8 +115,8 @@ static size_t linux_get_freemem(void)
procbuf
[
numread
]
=
'\0'
;
/* Kernel is too old to support MEMAVAILABLE
so get values using old calculation
/* Kernel is too old to support MEMAVAILABLE
so get values using old calculation
*/
if
((
memTag
=
strstr
(
buf
,
MEMAVAILABLE
))
==
NULL
)
{
...
...
@@ -162,7 +166,7 @@ size_t GetTotalSysMem(void)
#ifdef __linux__
return
linux_get_totalmem
();
#endif
#ifdef _WIN32
_
#ifdef _WIN32
return
win_get_totalmem
();
#endif
/* Guess 48 MB. */
...
...
@@ -174,7 +178,7 @@ size_t GetFreeSysMem(void)
#ifdef __linux__
return
linux_get_freemem
();
#endif
#ifdef _WIN32
_
#ifdef _WIN32
return
win_get_freemem
();
#endif
/* Guess 48 MB. */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment