Commit Graph

11 Commits

Author SHA1 Message Date
Nicholas Nethercote
5a62942911 servo: Merge #18938 - Replace all uses of the heapsize crate with malloc_size_of (from nnethercote:bug-1409255); r=SimonSapin
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix https://bugzilla.mozilla.org/show_bug.cgi?id=1409255

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because testing is on the Gecko side.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: 4c538b642e4bdfbf42c522c5a59c258a6d14546e

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : f9a6feed1088d0b0be2b55d7f0c2ec9c594ac33b
2017-10-18 13:56:05 -05:00
Corey Farwell
b429779be4 servo: Merge #14495 - Rename Reflectable to DomObject (from frewsxcv:reflectable-domobject); r=jdm
Fixes https://github.com/servo/servo/issues/8473.

Source-Repo: https://github.com/servo/servo
Source-Revision: b192ae9db7082346a4a6a985c5557d4cea75d50e
2016-12-08 12:41:08 -08:00
Anthony Ramine
c0e4adbd32 servo: Merge #9622 - Bump heapsize to 0.3 (from nox:heapsize); r=ecoal95
Source-Repo: https://github.com/servo/servo
Source-Revision: a164176876bb6abccf729eb5d6334e3c22230103
2016-02-13 18:21:41 +05:01
Anthony Ramine
08f5c3da70 servo: Merge #9532 - Say farewell to in-tree HeapSizeOf (from nox:dedup-heapsize); r=Manishearth
Source-Repo: https://github.com/servo/servo
Source-Revision: 2a6707ce58df27d93e865bffb6b44d396b810c99
2016-02-05 03:11:36 +05:01
rohan.prinja
e8b504412b servo: Merge #8221 - move modules around (from ajnirp:8130-reorganise); r=jdm
for #8130

Source-Repo: https://github.com/servo/servo
Source-Revision: daad09d44245228fba9118316937add71bec7c58
2015-11-04 02:27:02 +05:01
Anthony Ramine
9be943ec1a servo: Merge #7972 - Introduce DOMClass::heap_size_of (from nox:codegen-heapsize); r=Ms2ger
It holds a function pointer to the HeapSizeOf::heap_size_of_children()
implementation corresponding to that IDL interface.

This removes the need for a clumsly TypeId-based match expression in the
former heap_size_of_eventtarget() function.

Source-Repo: https://github.com/servo/servo
Source-Revision: 5a0a91eba794af027723051c7f039cb22088aa65
2015-10-15 07:13:55 -06:00
Anthony Ramine
d5038d123e servo: Merge #7873 - Generate the various TypeId enums in codegen (from nox:codegen-typeid); r=Ms2ger
This frees us forever from caring about maintaining these enums. The last commit removes their use from the initialisation of interface objects derived from Node.

Source-Repo: https://github.com/servo/servo
Source-Revision: 32daa17d5cbcad02db0713e21e52410cdc60480e
2015-10-14 12:47:48 -06:00
Corey Farwell
bdb575df39 servo: Merge #7976 - Cleanup code that was warned by rust-clippy (from frewsxcv:clippy); r=jdm
[whitespace agnostic diff](https://github.com/servo/servo/pull/7976/files?w=1)

Source-Repo: https://github.com/servo/servo
Source-Revision: ac1b595609a08c30d6c13dfe6e7705f061bbc010
2015-10-12 04:37:42 -06:00
Anthony Ramine
6953aa403a servo: Merge #7606 - Move the type_id fields to DOMClass (from nox:move-typeid); r=jdm
Cc @michaelwu.

Source-Repo: https://github.com/servo/servo
Source-Revision: d5ee58caf269779e86b2efc50ddf37d3e4eba9b9
2015-09-13 11:53:42 -06:00
Bogdan Cuza
b3e4dcef5f servo: Merge #7097 - Measure heap memory usage for more types. Fixes #6951 (from boghison:memtypes); r=jdm
Also adds HeapSizeOf implementations/derive for some types. I've used "Cannot calculate Heap size" as a reason everywhere, because my imagination is rather limited. If you'd like me to change this message for specific types, please write something like this: "Trusted - Cannot calculate Heap size for Trusted" so that it would be easier for me to replace them through a script :)

Source-Repo: https://github.com/servo/servo
Source-Revision: a03616f379c255cc6c9b6e1d04dd7d98bd9926ce
2015-08-13 13:16:14 -06:00
Josh Matthews
2f1aaef81d servo: Merge #6874 - Start reporting memory usage for Window and all nodes in all DOM tree… (from jdm:domreporting); r=njn
…s for frame treese in script tasks.

This underreports by a significant amount, since only Document, Window and CharacterData (ie. text) nodes are fully represented. That being said, every HTML element in the tree is measured, but only counted as a Node. It's easy to improve this, it just requires adding the appropriate HeapSizeOf derives and increasing the granularity of `measure_memory_for_eventtarget`. google.com shows a dom-tree value of 0.24 MB for me at the moment.

r? @nnethercote

Source-Repo: https://github.com/servo/servo
Source-Revision: 84e25befdd97cf74fb00707dbe150d59d980e977
2015-08-03 21:24:41 -06:00