linkage

JVM内存区域

心不动则不痛 提交于 2020-08-14 15:31:27
JVM 内存区域主要分为线程私有区域【程序计数器、虚拟机栈、本地方法区】、线程共享区 域【JAVA 堆、方法区】、直接内存。 线程私有数据区域生命周期与线程相同, 依赖用户线程的启动/结束 而 创建/销毁(在 Hotspot VM 内, 每个线程都与操作系统的本地线程直接映射, 因此这部分内存区域的存/否跟随本地线程的 生/死对应)。 线程共享区域随虚拟机的启动/关闭而创建/销毁。 直接内存并不是 JVM 运行时数据区的一部分, 但也会被频繁的使用: 在 JDK 1.4 引入的 NIO 提 供了基于 Channel 与 Buffer 的 IO 方式, 它可以使用 Native 函数库直接分配堆外内存, 然后使用 DirectByteBuffer 对象作为这块内存的引用进行操作(详见: Java I/O 扩展), 这样就避免了在 Java 堆和 Native 堆中来回复制数据, 因此在一些场景中可以显著提高性能。 程序计数器(线程私有) 一块较小的内存空间, 是当前线程所执行的字节码的行号指示器,每条线程都要有一个独立的 程序计数器,这类内存也称为“线程私有”的内存。 正在执行 java 方法的话,计数器记录的是虚拟机字节码指令的地址(当前指令的地址)。如 果还是 Native 方法,则为空。 这个内存区域是唯一一个在虚拟机中没有规定任何 OutOfMemoryError 情况的区域

谈谈JVM(基础模型)

元气小坏坏 提交于 2020-08-13 08:58:52
一,基本概念 JVM是可运行Java代码的假想计算机 ,包括一套字节码指令集、一组寄存器、一个栈、 一个垃圾回收,堆 和 一个存储方法域。 JVM 是运行在操作系统之上的,它与硬件没有直接 的交互。 二,运行的过程 先看内存模型   我们都知道 Java 源文件,通过编译器,能够生产相应的.Class 文件,也就是字节码文件, 而字节码文件又通过Java虚拟机中的解释器,编译成特定机器上的机器码 。   也就是如下:   ① Java源文件—->编译器—->字节码文件   ② 字节码文件—-> JVM —->机器码   每一种平台的解释器是不同的,但是实现的虚拟机是相同的,这也就是 Java 为什么能够 跨平台的原因了 ,当一个程序从开始运行,这时虚拟机就开始实例化了, 多个程序启动就会 存在多个虚拟机实例。程序退出或者关闭,则虚拟机实例消亡,多个虚拟机实例之间数据不 能共享。   程序计数器(线程私有)     一块较小的内存空间, 是当前线程所执行的字节码的行号指示器,每条线程都要有一个独立的 程序计数器,这类内存也称为“线程私有”的内存。     正在执行 java 方法的话,计数器记录的是虚拟机字节码指令的地址(当前指令的地址)。如果还是Native方法,则为空。     这个内存区域是唯一一个在虚拟机中没有规定任何OutOfMemoryError情况的区域。   虚拟机栈

Vue 含有"不限"的省市区三级联动的组件

天涯浪子 提交于 2020-08-09 21:37:43
工作中会经常会遇到选择省市区三级联动的需求,每次都有不同的需求,比如有不限,比如动态添加多个,比如宽度自定义,比如回显,回显类型不确定。。。等等。。。 每次都要根据需求定制,现在闲下来,将这些暂时遇到的需求整合到了一个组件里面,希望可以暂时救一下在花样需求的沼泽里出不来的人。 个人写的,肯定有可优化的地方,肯定有覆盖不到的地方。请见谅~,欢迎留下你的只言片语,足够我醍醐灌顶~~(不会成语的author,不是一个号前端) 支持一下需求: 基于element-ui写的,可自行更换或者用原生; 省市区三级,暂时不支持四级; 省市区列表是否包含"不限",可自行从父组件传参,参数:unlimit,取值:true - 有不限,false - 无不限 宽度自定义,可自行从父组件传参,参数:pWidth:省宽度,cWidth:市宽度,aWidth:区宽度 支持添加多个,如需记录index,传参:fatherIndex 地址map前端写死,如有改动,自行改动。 一、引入地址map依赖文件:map.js 地址: https://my.oschina.net/wsxiao/blog/4295971 二、地址选择下拉框子组件 <!-- @Author: DKing @Desc: 三级联动 @Date: 2020-04-30 --> <template> <div> <el-select v-model=

如何测试私有函数或具有私有方法,字段或内部类的类?

泪湿孤枕 提交于 2020-08-04 12:06:53
问题: How do I unit test (using xUnit) a class that has internal private methods, fields or nested classes? 如何对具有内部私有方法,字段或嵌套类的类进行单元测试(使用xUnit)? Or a function that is made private by having internal linkage ( static in C/C++) or is in a private ( anonymous ) namespace? 还是通过 内部链接 (在C / C ++中为 static )或在私有( 匿名 )名称空间中使其私有化的函数? It seems bad to change the access modifier for a method or function just to be able to run a test. 仅仅为了能够运行测试而更改方法或函数的访问修饰符似乎很糟糕。 解决方案: 参考一: https://stackoom.com/question/8zb/如何测试私有函数或具有私有方法-字段或内部类的类 参考二: https://oldbug.net/q/8zb/How-do-I-test-a-private-function-or-a-class

Are all constexpr variable implicitly inline?

痴心易碎 提交于 2020-07-17 05:51:53
问题 I was playing around with auto template parameters and I was surprised that this code didn't compiled: constexpr auto bar = 2; template<auto& T> struct Foo { auto operator()() const { return T; } }; int main() { Foo<bar> b; b(); } Visual Studio 15.7 (preview 4) spit out these errors: error C2970: 'Foo': template parameter 'T': 'bar': an expression involving objects with internal linkage cannot be used as a non-type argument note: see declaration of 'Foo' note: see declaration of 'bar' error

Are all constexpr variable implicitly inline?

 ̄綄美尐妖づ 提交于 2020-07-17 05:51:51
问题 I was playing around with auto template parameters and I was surprised that this code didn't compiled: constexpr auto bar = 2; template<auto& T> struct Foo { auto operator()() const { return T; } }; int main() { Foo<bar> b; b(); } Visual Studio 15.7 (preview 4) spit out these errors: error C2970: 'Foo': template parameter 'T': 'bar': an expression involving objects with internal linkage cannot be used as a non-type argument note: see declaration of 'Foo' note: see declaration of 'bar' error

Using static keyword in definition vs declaration in C

て烟熏妆下的殇ゞ 提交于 2020-06-27 17:21:54
问题 The following compiles fine, using static only during declaration of function: #include <stdio.h> static int a(); int a(){ return 5; } int main(){ printf("%d\n", a()); return 0; } As a side note, same behaviour as above happens with inline functions, i.e only the declaration could have the keyword. However the following fails, doing the same but on a variable: #include <stdio.h> static int a; int a = 5; int main(){ printf("%d\n", a); return 0; } Getting thew error: non-static declaration of

Using static keyword in definition vs declaration in C

蓝咒 提交于 2020-06-27 17:21:06
问题 The following compiles fine, using static only during declaration of function: #include <stdio.h> static int a(); int a(){ return 5; } int main(){ printf("%d\n", a()); return 0; } As a side note, same behaviour as above happens with inline functions, i.e only the declaration could have the keyword. However the following fails, doing the same but on a variable: #include <stdio.h> static int a; int a = 5; int main(){ printf("%d\n", a); return 0; } Getting thew error: non-static declaration of

Linkage of function declared as `extern` in block scope according to the C++17 standard draft

时光毁灭记忆、已成空白 提交于 2020-05-29 06:08:10
问题 From the C++17 Standard Draft § 3.5.6 : The name of a function declared in block scope and the name of a variable declared by a block scope extern declaration have linkage. If there is a visible declaration of an entity with linkage having the same name and type , ignoring entities declared outside the innermost enclosing namespace scope, the block scope declaration declares that same entity and receives the linkage of the previous declaration. If there is more than one such matching entity,

GWAS条件分析(conditional analysis)

心不动则不痛 提交于 2020-05-02 18:07:16
一、为什么要做GWAS的条件分析(conditional analysis) 我们做GWAS的时候,经常扫出一堆显著的信号,假设rs121是我们扫出来与某表型最显著相关的位点(P=1.351e-36),rs124尾随其后(6.673e-22),也是与该表型显著相关,那么这个时候,我们就有问题了:这个rs124位点是真的与该表型显著相关,还是因为rs124与rs121高度连锁不平衡(linkage disequilibrium)。换句话说,rs124之所以出类拔萃,是因为它本身厉害,还是有rs121提拔,导致我们看到的结果是:rs124永远跟随者rs121水涨船高。为了解决这个问题,我们就需要做条件分析。 二、GWAS的条件分析(conditional analysis)步骤 如果你有全基因组关联分析的基础的话,条件分析的工作则很简单,只需要在原来的基础上加上“--condition”的参数,具体为: 如果表型为case/control的情况: ./plink --bfile ./data --condition rs121 --logistic --pheno ./pheno.txt --mpheno 1 --covar ./covar.txt --covar-number 1.2 --out ./gwas_condition    如果表型为连续性变量的情况: ./plink -