Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
6d02fe5b
Commit
6d02fe5b
authored
Jul 17, 2012
by
Paul Eggert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* alloc.c (Fmemory_free): Account for memory-free's own storage.
Round up, not down. Improve doc.
parent
88ecaf8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
23 deletions
+30
-23
src/ChangeLog
src/ChangeLog
+5
-0
src/alloc.c
src/alloc.c
+25
-23
No files found.
src/ChangeLog
View file @
6d02fe5b
2012-07-17 Paul Eggert <eggert@cs.ucla.edu>
* alloc.c (Fmemory_free): Account for memory-free's own storage.
Round up, not down. Improve doc.
2012-07-17 Dmitry Antipov <dmantipov@yandex.ru>
Restore old code in allocate_string_data to avoid Faset breakage.
...
...
src/alloc.c
View file @
6d02fe5b
...
...
@@ -6581,33 +6581,35 @@ We divide the value by 1024 to make sure it fits in a Lisp integer. */)
}
DEFUN
(
"memory-free"
,
Fmemory_free
,
Smemory_free
,
0
,
0
,
0
,
doc
:
/* Return a list of two counters that measure how much free memory
is hold by the Emacs process. Both counters are in KBytes. First
counter shows how much memory holds in a free lists maintained by
the Emacs itself. Second counter shows how much free memory is in
the heap (freed by Emacs but not released back to the operating
system). If the second counter is zero, heap statistics is not
available. */
)
doc
:
/* Return a list (E H) of two measures of free memory.
E counts free lists maintained by Emacs itself. H counts the heap,
freed by Emacs but not released to the operating system; this is zero
if heap statistics are not available. Both counters are in units of
1024 bytes, rounded up. */
)
(
void
)
{
Lisp_Object
data
[
2
];
data
[
0
]
=
make_number
(
min
(
MOST_POSITIVE_FIXNUM
,
(
total_free_conses
*
sizeof
(
struct
Lisp_Cons
)
+
total_free_markers
*
sizeof
(
union
Lisp_Misc
)
+
total_free_symbols
*
sizeof
(
struct
Lisp_Symbol
)
+
total_free_floats
*
sizeof
(
struct
Lisp_Float
)
+
total_free_intervals
*
sizeof
(
struct
interval
)
+
total_free_strings
*
sizeof
(
struct
Lisp_String
)
+
total_free_vector_bytes
)
/
1024
));
/* Make the return value first, so that its storage is accounted for. */
Lisp_Object
val
=
Fmake_list
(
make_number
(
2
),
make_number
(
0
));
XSETCAR
(
val
,
(
make_number
(
min
(
MOST_POSITIVE_FIXNUM
,
((
total_free_conses
*
sizeof
(
struct
Lisp_Cons
)
+
total_free_markers
*
sizeof
(
union
Lisp_Misc
)
+
total_free_symbols
*
sizeof
(
struct
Lisp_Symbol
)
+
total_free_floats
*
sizeof
(
struct
Lisp_Float
)
+
total_free_intervals
*
sizeof
(
struct
interval
)
+
total_free_strings
*
sizeof
(
struct
Lisp_String
)
+
total_free_vector_bytes
+
1023
)
>>
10
)))));
#ifdef DOUG_LEA_MALLOC
data
[
1
]
=
make_number
(
min
(
MOST_POSITIVE_FIXNUM
,
mallinfo
().
fordblks
/
1024
));
#else
data
[
1
]
=
make_number
(
0
);
XSETCAR
(
XCDR
(
val
),
make_number
(
min
(
MOST_POSITIVE_FIXNUM
,
(
mallinfo
().
fordblks
+
1023
)
>>
10
)));
#endif
return
Flist
(
2
,
data
)
;
return
val
;
}
DEFUN
(
"memory-use-counts"
,
Fmemory_use_counts
,
Smemory_use_counts
,
0
,
0
,
0
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment