/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <algorithm> #include <atomic> #include <chrono> #include <folly/detail/Futex.h> #include <folly/hash/Hash.h> #include <folly/synchronization/AtomicStruct.h> #include <folly/system/ThreadId.h> namespace folly { namespace detail { /// MemoryIdler provides helper routines that allow routines to return /// some assigned memory resources back to the system. The intended /// use is that when a thread is waiting for a long time (perhaps it /// is in a LIFO thread pool and hasn't been needed for a long time) /// it should release its thread-local malloc caches (both jemalloc and /// tcmalloc use these for better performance) and unmap the stack pages /// that contain no useful data. struct MemoryIdler { … }; } // namespace detail } // namespace folly