我可以配置WiredTiger存储引擎中MongoDB 3.0.0引入的配置选项的最小cacheSizeGB数是多少?
代表多少cacheSizeGB必须是整数?是否可以使用15.5这样的浮点数进行配置?
我无法从MongoDB官方文档中找到详细信息。
我编写这样的代码来帮助我理解realloc()函数的用法.也许在以下代码中存在一些问题.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5
6 void dynamic_memory_management_func()
7 {
8 printf("------------dynamic_memory_management_func------------\n");
9
10 char *str1 = (char *)malloc(16);
11 memset(str1, 0, 16);
12 strcpy(str1, "0123456789AB");
13 char *str2 = realloc(str1, 8);
14
15 printf("str1 value: %p [%s]\n", str1, str1);
16 printf("str2 value: %p [%s]\n", str2, str2);
17
18 free(str2);
19 str2 = NULL;
20
21 char *str3 = (char *)malloc(16);
22 memset(str3, 0, 16);
23 strcpy(str3, "0123456789AB");
24 char *str4 …Run Code Online (Sandbox Code Playgroud) 在我的 bash 脚本中,我想用来getopts解析命令行选项。
我的第一次尝试是学习如何使用它,如下:
#!/bin/bash
v_option_arg=""
r_option_arg=""
h_option_arg=""
function get_opt_args() {
while getopts ":v:r:h:" opt
do
case $opt in
"v")
v_option_arg="$OPTARG"
;;
"h")
h_option_arg="$OPTARG"
;;
"r")
r_option_arg="$OPTARG"
;;
"?")
echo "Unknown option -$OPTARG"
exit 1
;;
":")
echo "No argument value for option -$OPTARG"
;;
*)
# Should not occur
echo "Unknown error while processing options"
;;
esac
done
shift $((OPTIND-1))
}
get_opt_args $@
if [ ! -z "$v_option_arg" ]; then
echo "Argnument value for option -v: $v_option_arg" …Run Code Online (Sandbox Code Playgroud)