如何使用具有多个生成器选项的thrift java代码生成器(How to use thrift java code generator with multiple generator options)
我正在查看thirft代码生成器的文档。 它是这样开始的:
Usage: thrift [options] file Options: -version Print the compiler version -o dir Set the output directory for gen-* packages (default: current directory) -out dir Set the ouput location for generated files. (no gen-* folder will be created) -I dir Add a directory to the list of directories searched for include directives -nowarn Suppress all compiler warnings (BAD!) -strict Strict compiler warnings on -v[erbose] Verbose mode -r[ecurse] Also generate included files -debug Parse debug trace to stdout --allow-neg-keys Allow negative field keys (Used to preserve protocol compatibility with older .thrift files) --allow-64bit-consts Do not print warnings about using 64-bit constants --gen STR Generate code with a dynamically-registered generator. STR has the form language[:key1=val1[,key2,[key3=val3]]]. Keys and values are options passed to the generator. Many options will not require values.
进一步下来是这样的:
java (Java): beans: Members will be private, and setter methods will return void. private-members: Members will be private, but setter methods will return 'this' like usual. nocamel: Do not use CamelCase field accessors with beans. hashcode: Generate quality hashCode methods. android_legacy: Do not use java.io.IOException(throwable) (available for Android 2.3 and above). java5: Generate Java 1.5 compliant code (includes android_legacy flag). sorted_containers: Use TreeSet/TreeMap instead of HashSet/HashMap as a implementation of set/map.
我得到了这个工作: - gen java:beans,但我无法弄清楚如何包含多个选项。 我不明白这意味着什么:语言[:key1 = val1 [,key2,[key3 = val3]]]
我尝试过这样的事情:“java [:beans,[:hashcode]]”,“java:[beans,hashcode]”“java [:beans,:hashcode]”“java:beans java:hashcode”“java [: bean [,hashcode]]“等
I'm looking at documentation for thirft code generator. It starts like this:
Usage: thrift [options] file Options: -version Print the compiler version -o dir Set the output directory for gen-* packages (default: current directory) -out dir Set the ouput location for generated files. (no gen-* folder will be created) -I dir Add a directory to the list of directories searched for include directives -nowarn Suppress all compiler warnings (BAD!) -strict Strict compiler warnings on -v[erbose] Verbose mode -r[ecurse] Also generate included files -debug Parse debug trace to stdout --allow-neg-keys Allow negative field keys (Used to preserve protocol compatibility with older .thrift files) --allow-64bit-consts Do not print warnings about using 64-bit constants --gen STR Generate code with a dynamically-registered generator. STR has the form language[:key1=val1[,key2,[key3=val3]]]. Keys and values are options passed to the generator. Many options will not require values.
further down there is this:
java (Java): beans: Members will be private, and setter methods will return void. private-members: Members will be private, but setter methods will return 'this' like usual. nocamel: Do not use CamelCase field accessors with beans. hashcode: Generate quality hashCode methods. android_legacy: Do not use java.io.IOException(throwable) (available for Android 2.3 and above). java5: Generate Java 1.5 compliant code (includes android_legacy flag). sorted_containers: Use TreeSet/TreeMap instead of HashSet/HashMap as a implementation of set/map.
I got this working: --gen java:beans, but I can't figure out how to include multiple options. I don't understand what this means: language[:key1=val1[,key2,[key3=val3]]]
I have tried things like: "java[:beans,[:hashcode]]", "java:[beans,hashcode]" "java[:beans,:hashcode]" "java:beans java:hashcode" "java[:beans[,hashcode]]" etc.
原文:https://stackoverflow.com/questions/23121808
最满意答案
问题是你正在查看任务管理器中显示的默认内存列,即“内存 - 私有工作集”。 这并不反映实际保留使用的内容。
在“任务管理器”中,转到“视图”菜单,然后选择“选择列”。 添加“内存 - 提交大小”列。 您应该看到此列反映了Java中保留的堆大小。 在我的测试中,它显示约为6.6GB的命令行-Xms6G。
“ 内存 - 专用工作集:工作集的子集,专门描述进程正在使用的内存量,这是其他进程无法共享的。”
“ 内存 - 提交大小:保留供进程使用的虚拟内存量。”
The issue is you're looking at the default memory column shown in Task Manager, which is "Memory - Private Working Set." This doesn't reflect what is actually reserved for use.
In Task Manager, go to the View menu and choose Select Columns. Add the "Memory - Commit Size" column. You should see this column reflects the reserved heap size from Java. In my tests, it shows around 6.6GB committed for a commandline of -Xms6G.
Here is Microsoft's page that explains what each column means.
"Memory - Private Working Set: Subset of working set that specifically describes the amount of memory a process is using that cannot be shared by other processes."
"Memory - Commit Size: Amount of virtual memory that is reserved for use by a process."
相关问答
更多-
内存主机和内存参数之间的关系来自Java的xms和xmx(Relation between memory host and memory arguments xms and xmx from Java)[2021-05-31]
Java进程使用的内存(如操作系统所见)不仅限于Java堆。 还应该计算更多的内存区域: Metaspace(类元数据所在的地方); 代码缓存(存储JIT编译的方法和所有生成的代码); 直接字节缓冲区; 内存映射文件,包括由JVM映射的文件,例如类路径上的所有JAR文件; 线程堆栈; JVM代码本身以及Java Runtime加载的所有动态库; 其他内部JVM结构。 使用NativeMemoryTracking JDK功能获取JVM使用的内存区域的详细分类: java -XX:NativeMemoryTra ... -
这取决于你的java使用的GC。 并行GC可能会在更大的内存设置上运行得更好 - 我不是专家。 一般来说,如果你有更大的记忆体,那么需要GC-ed的频率就会越来越少 - 垃圾的余地很大。 然而,当谈到GC时,GC必须处理更多的内存,反过来可能会更慢。 It depends on the GC your java is using. Parallel GCs might work better on larger memory settings - I'm no expert on that though. ...
-
问题是你正在查看任务管理器中显示的默认内存列,即“内存 - 私有工作集”。 这并不反映实际保留使用的内容。 在“任务管理器”中,转到“视图”菜单,然后选择“选择列”。 添加“内存 - 提交大小”列。 您应该看到此列反映了Java中保留的堆大小。 在我的测试中,它显示约为6.6GB的命令行-Xms6G。 以下是Microsoft的页面,它解释了每个列的含义。 “ 内存 - 专用工作集:工作集的子集,专门描述进程正在使用的内存量,这是其他进程无法共享的。” “ 内存 - 提交大小:保留供进程使用的虚拟内存量。” ...
-
尝试分配超过128M Xms时的JVM错误,而不指定Xmx(JVM error when try to allocate more than 128M Xms, without specifying Xmx)[2022-04-14]
任何想法? 显而易见的结论是,如果要使用-Xms指定初始堆大小,并且希望将大小设置为大于默认最大堆大小的值,则需要指定最大堆大小。 您在不同计算机上获得不同结果的原因是JVM以不同方式计算默认堆大小,具体取决于Java的版本和执行平台。 在某些情况下,它是一个常数。 在其他情况下,它取决于系统上的物理内存量。 只需明确设置最大堆大小,您就不会遇到此问题。 如果要查找给定计算机的默认堆大小,请运行以下命令: java -XX:+PrintFlagsFinal -version Any idea? Well ... -
Windows上的java进程使用的内存少于-xms中指定的内存?(java process on windows using less memory than specified in -xms?)[2023-05-29]
Windows任务管理器是为最终用户而设计的,而不是为程序员设计的。 后者通常更喜欢Sysinternals套件中的Process Explorer( procexp.exe )。 与vmmap.exe结合使用,可以准确显示正在发生的事情。 The windows task manager has been designed for end users, not for programmers. The latter usually prefer the Process Explorer (procexp. ... -
这里的问题似乎是以下因素的组合问题: 旧集群是RHEL5和新RHEL6 RHEL6包含对glibc的更新,它更改了MALLOC报告多线程程序的内存使用情况的方式。 JVM默认包含多线程垃圾收集器 为了解决这个问题,我使用了以下几种组合: 将MALLOC_ARENA_MAX环境变量导出为较小的数字(1-10),例如在作业脚本中。 即包括: export MALLOC_ARENA_MAX=1 适度增加SGE内存请求10%左右 使用java -XX:ParallelGCThreads=1 ...明确地将java ...
-
无法通过.bat文件设置jvm参数/参数(Xmx和Xms)(Unable to set jvm parameters/arguments (Xmx and Xms) through .bat file)[2022-11-27]
直接使用参数 java -Xmx1024m -Xms256m -XX:+HeapDumpOnOutOfMemoryError -cp TA.jar com.myClass 你不需要在JAVA_OPTIONS设置它们。 要确定您的应用程序正在使用您需要的参数: 打开java自带的jvisualvm 。 只需在命令行键入“jvisualvm”,如果你已经在你的路径上正确设置了java。 打开虚拟机启动到您的应用程序。 请在“ 概览 ”选项卡中的“JVM参数”下进行检查。 应该设置你的jvm选项。 Use th ... -
osx上的java - xmx被忽略了?(java on osx - xmx ignored?)[2022-03-09]
这与操作系统的工作方式有所不同。 Linux有一个“固定”交换的概念 - 这是基于物理RAM +添加到系统的各种交换文件/交换分区。 这被认为是可以提交的最大内存限制。 OSX不认为交换是固定的。 随着越来越多的内存在操作系统上提交,它将继续添加交换文件(您可以在/var/vm看到添加的文件)。 因此,您可以向OSX请求比可用内存更多的内存,并且它将有效地回复'ok',而在linux下它将变为'no'。 上限仍然由java强制执行 - 一旦堆超过指定的大小,它将返回java.lang.OutOfMemory ... -
一般规则是在发现需要解决的问题之前,不应更改JVM内存设置。 JVM在调整运行时的大多数参数以适应您的应用程序方面做得非常出色。 如果您发现需要优化内存参数,则取决于您需要优化的内容。 您将使用的设置会有很大差异,具体取决于您需要优化的方面(例如,最小化暂停的设置与最大化吞吐量的设置非常不同)。 如果您确实需要进行优化,请提供有关优化所需方面的更多信息。 The general rule is that you should not change the JVM memory settings before ...
-
是的,JVM必须分配更多内存并重新安排所有堆空间(Eden,from,to,old和PermGen)以适应新内存。 如果您计划让您的webapp使用一定数量的堆空间,那么最好在性能方面预先分配整个堆。 一旦完成,JVM将永远不会释放它从操作系统中获取的内存。 因此,如果您需要4GiB堆并且JVM最终需要它,那么您的堆将保持在4GiB,直到JVM终止。 Yes, the JVM has to allocate more memory and re-arrange all of the heap spaces ...