Skip to content

Commit

Permalink
[website] Update documentation
Browse files Browse the repository at this point in the history
Summary:
```
% groff --version
GNU groff version 1.23.0
Copyright (C) 2022 Free Software Foundation, Inc.
GNU groff comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of groff and its subprograms
under the terms of the GNU General Public License.
For more information about these matters, see the file
named COPYING.

called subprograms:

GNU grops (groff) version 1.23.0
GNU troff (groff) version 1.23.0

% odoc --version
2.2.0

% make doc-publish
```

Reviewed By: skcho

Differential Revision: D51470930

fbshipit-source-id: dbfae13a6effd8b84125274d2915b8b0c3110fa2
  • Loading branch information
nicovank authored and facebook-github-bot committed Nov 21, 2023
1 parent 971d601 commit 889d4c8
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions website/docs/all-issue-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -2111,21 +2111,35 @@ Reported as "Pulse Reference Stability" by [pulse](/docs/next/checker-pulse).
The family of maps `folly::F14ValueMap`, `folly::F14VectorMap`, and by extension
`folly::F14FastMap` differs slightly from `std::unordered_map` as it does not
provide reference stability. Hence, when the map resizes such as when `reserve`
is called or new elements are added, all existing references become stale and
provide reference stability. When the map resizes such as when `reserve` is
called or new elements are added, all existing references become invalid and
should not be used.
For example:
`operator[]` is an interesting case as it can easily introduce unsafe code when
used twice in the same expression. Depending on what keys are present and which
order the compiler sequences sub-expressions, an insert via `operator[]` can
invalidate a reference obtained in the same expression before it's read from.
Typically, those cases can be improved by using other map functions such as
`at`, `find`, `emplace`, or `insert_or_assign` to increase code quality and
safety.
Examples:
```cpp
#include <folly/container/F14Map.h>
void use_reference_after_growth_bad() {
folly::F14FastMap<int, int> map = {{1, 1}, {2, 4}, {3, 9}};
void use_reference_after_growth_bad(folly::F14FastMap<int, int>& map) {
const auto& valueRef = map.at(1);
map.emplace(4, 16);
map.emplace(13, 71);
const auto valueCopy = valueRef;
}
void unsafe_expressions_bad(folly::F14FastMap<int, int>& map) {
// Unsafe expressions in situations where one or both keys are not present.
map[13] = map[71];
const auto p = map[13] * map[71];
const auto q = f(map[13], map[71]);
}
```

## PULSE_RESOURCE_LEAK
Expand Down

0 comments on commit 889d4c8

Please sign in to comment.