niuk

 

2018年9月10日

go调查内存泄漏

摘要: curl x.x.x.x/debug/pprof/heap > base.heap 过段时间 curl x.x.x.x/debug/pprof/heap > current.heap go tool pprof -svg -base base.heap <binary> current.heap > 阅读全文

posted @ 2018-09-10 20:37 niuk 阅读(218) 评论(0) 推荐(0) 编辑

2018年1月21日

c++ 使用模板按类型统计stl多维容器中元素的数量

摘要: struct ItemCounter{template<typename T1, typename T2, typename = typename std::enable_if<!std::is_same<T1, typename T2::value_type::second_type>::valu 阅读全文

posted @ 2018-01-21 21:44 niuk 阅读(202) 评论(0) 推荐(0) 编辑

2017年7月5日

phxpaxos遇到反复拉取checkpoint但是反复失败的问题,给其它节点造成压力

摘要: 原因: 接收checkpoint时与接收普通message共用IOLoop中的队列,当遇到队列满或者超内存时,会造成checkpoint的包随机丢失的问题 解决办法: 遇到checkpoint时不丢弃。 阅读全文

posted @ 2017-07-05 12:16 niuk 阅读(117) 评论(0) 推荐(0) 编辑

2017年5月27日

phxpaxos实现状态机CAS操作

摘要: 看过了phxpaxos的实现,发现选主逻辑中非主也能够调用Propose。因此即使开启了选主功能,也可能会出现两个人同时Propose的场景。而Propose时,InstanceID只是作为输出而非输入。因此也无法保证CAS操作的一致性。 目前想到的一种解决方案:修改Propose的内部实现,开启选 阅读全文

posted @ 2017-05-27 12:51 niuk 阅读(302) 评论(0) 推荐(0) 编辑

2017年5月19日

使用phxpaxos开发过程中遇到的坑

摘要: 1. 开启BatchPropose后,状态机使用ExecuteForCheckpoint生成快照要注意: ExecuteForCheckpoint中的InstanceID不能立即持久化。 例如: 当instance id = 3中包含多个值的时候,如果执行第一个值就更新的checkpoint ver 阅读全文

posted @ 2017-05-19 18:32 niuk 阅读(329) 评论(0) 推荐(0) 编辑

2017年4月26日

std::condition_variable::wait_until segment

摘要: 原因是使用了 -static 改为 -static-libstdc++ -static-libgcc 阅读全文

posted @ 2017-04-26 15:27 niuk 阅读(123) 评论(0) 推荐(0) 编辑

2017年1月9日

c++ protected 访问限定

摘要: class A { protected: int mA; }; class B : public A{ public: void Func() { mA = 0; // ok A *a = this; // failed a->mA = 0; } };~ 阅读全文

posted @ 2017-01-09 16:09 niuk 阅读(112) 评论(0) 推荐(0) 编辑

2016年6月7日

c++多态

摘要: 运行结果 加不加括号会决定是否表现出多态行为 阅读全文

posted @ 2016-06-07 17:07 niuk 阅读(103) 评论(0) 推荐(0) 编辑

2013年6月15日

.net mvc 解决Json序列化时循环引用问题及动态选择序列化字段

摘要: public class JsonNetResult : JsonResult { private class ExcludePropertiesContractResolver : DefaultContractResolver { IEnumerable<string> lstExclude; public ExcludePropertiesContractResolver(IEnumerable<string> excludedProperties) { lstExclude = excludedPro... 阅读全文

posted @ 2013-06-15 03:36 niuk 阅读(872) 评论(0) 推荐(0) 编辑

2012年4月12日

省赛注意

摘要: 遇到非整数一定要用doublezoj 3488 输入数据是浮点型zoj 3601 输入输出一定不要用cin 如果用string要让他自己转换而不是用cin输入 阅读全文

posted @ 2012-04-12 20:50 niuk 阅读(145) 评论(0) 推荐(0) 编辑

导航