c++里的对齐语义
大多数结构都要求地址按照align对齐,这个align值一般是4或者8。c++中的一些在align场景下常用的关键字 1 alignment 常规意义下,对齐意味着当前变量的起始地址是针对align做mod的结果是0的,具体的看代码 #include <iostream> #include <cstdint> using namespace std; #de...
大多数结构都要求地址按照align对齐,这个align值一般是4或者8。c++中的一些在align场景下常用的关键字 1 alignment 常规意义下,对齐意味着当前变量的起始地址是针对align做mod的结果是0的,具体的看代码 #include <iostream> #include <cstdint> using namespace std; #de...
leveldb里的组件,负责内存分配的,写的比较简陋 接口就两个,一个分配普通内存,一个分配对齐内存的 class Arena { public: // Return a pointer to a newly allocated memory block of "bytes" bytes. char* Allocate(size_t bytes); // Allocate...
重新理解ring buffer这种牛逼的结构,太牛逼了 chromium里单线程的版本,抄一下代码 // Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #...
about mem memory-barrier part-2-memory-model 再谈C++原子操作与内存屏障 其实还是perfbook里那些 c++ memory manage Thanks for the memory (allocator) 之前一直以为allocator里想侯捷写的,跟malloc一样分bin,结果发现那是sgi的实现… O...
end()能++吗 The behavior is undefined if the specified sequence of increments or decrements would require that a non-incrementable iterator (such as the past-the-end iterator) is incremented, or tha...
主要鉴赏一些move写出来的bug for里使用move 在for里使用move需要考虑细致一点,鉴定一个场景 std::unique_ptr<Task> task(...) for (0..theadpool.size()) { threadpool[i].run(std::move(task)); } ThreadPool::run(UniqueTask ta...
1 按照预期体重计算数据 1.1 碳水 分体质,外胚(3g/kg), 内胚(2g/kg) 按照预期体重(+-5kg), 计算一天碳水总量,把一天的碳水总量 * 7得到一周碳水总量 1.2 脂肪 分体质,外胚(1g/kg), 内胚(0.8g/kg) 按照预期体重(+-5kg), 计算一天脂肪总量,把一天的脂肪总量 * 7得到一周的脂肪总量 1.3 蛋白质 ...
wireshark里天然支持tls解密,比较简单的方法是设置SSLKEYLOGFILE环境变量,wireshark会自动读取这个文件。 创建SSLKEYLOGFILE文件 windows setx SSLKEYLOGFILE C:\Path\To\sslkeylogfile.txt unix export SSLKEYLOGFILE=/Path/To/sslkeylogfile....
How do SO_REUSEADDR and SO_REUSEPORT differ? How do SO_REUSEADDR and SO_REUSEPORT differ? 内功修炼内存篇 内功修炼内存篇 B-trees and database indexes B-trees and database indexes rust-tutorial ...
Anatomy of a Program in Memory Memory management is the heart of operating systems; it is crucial for both programming and system administration. While the concepts are generic, examples are mostl...