自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(7)
  • 收藏
  • 关注

原创 blink不能发,这里记录下

程序被加载到内存中运行,形成进程。进程局部变量和函数调用层级关系会保存在栈中。系统栈空间大小可以通过ulimit -s查看和修改,我目前使用的centos6系统,限值默认为8192k;如果程序中递归层级过深(如递归死循环),会造成栈占用空间超限值引发的崩溃。如果使用gdb打开程序运行,保持程序崩溃时不退出,获得此时异常程序的pid,使用pmap pid命令查看,结果打印中的[ stack ]栏的值就是当前程序占用的栈空间大小。与系统限值比较可以判定是否栈空间超限值导致的问题。一般只有递归逻辑不当,无限递归会

2021-07-02 09:51:22 14973

原创 字符串处理函数

今天做牛客网的输入输出练习时遇到几个函数以前没用过,记录下获取整行输入,空格不截断:getline(cin, input)对于获取的字符串,按照指定字符分割a. 可以使用c的strtok函数,同时指定多个分割符,很吊#include <iostream>#include <cstring>#include <algorithm>#include <vector>#include <string> using namespac

2021-06-20 21:01:02 363

原创 c++ 11中的智能指针使用介绍

c++11 关于auto_ptr智能指针需要引用头文件 <memory>c++ 11不再建议使用auto_ptr,编译时会产生 deprecated(及不赞成) 告警auto_ptr的功能可以被unique_ptr完全替换auto_ptr代码示例#include <iostream>#include <memory>using namespace std;int main(){ auto_ptr<string> p1 (new

2021-05-29 15:54:31 83

原创 多线程生产者和消费者的同步和互斥问题

多线程生产者和消费者的同步和互斥问题定义缓冲区大小为10,三个生产者线程,两个消费者线程,linux下利用互斥和状态变量实现生产者和消费者模型c++代码#include <pthread.h>#include <queue>#include <stdio.h>#include <unistd.h>using namespace std;#define MAX_MSG_LEN 10pthread_mutex_t mutex;pthread_

2021-05-27 17:27:09 272 4

原创 leetcode solution-l03

questionLongest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Input:

2020-07-09 20:20:47 97

原创 leetcode solution-l02

questionAdd Two NumbersYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.You may ass

2020-07-09 19:59:30 75

原创 leetcode solution-l01

questionGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same element twice.Example:Given nums = [2, 7, 11,

2020-07-09 19:54:22 95

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除