JVM reserves additional memory after object creation
Hi everybody,
i have a problem with starting the JVM from inside a C++application. Starting the VM with JNI_CreateJavaVM works as aspected. When creating the first object it seems like the JVM reserves additional memory (outside the heap). Here is a little c++ test case:
/* Compile/Link: cl -MT -Zi -EHsc -I%JAVA_HOME%\include jvmtest0.cxx user32.lib %JAVA_HOME%\lib\jvm.lib */
#include "windows.h"
#include <string>
#include <jni.h>
int availMem () {
int i,j;
void* v[2048];
for (i=0;i<2048;i++) {
if ((v=malloc(1024*1024))==0) break;
for (j=0;j<i;j++) free(v[j]);
return i;
int WINAPI WinMain(HINSTANCE hinst,HINSTANCE hprev,LPSTR cmd,int show)
int i1=availMem();
JavaVMInitArgs arg;
JavaVMOption opt[1];
arg.version=JNI_VERSION_1_2;
arg.ignoreUnrecognized=JNI_TRUE;
opt[0].optionString="-Xmx256m";
arg.nOptions=1;
arg.options=opt;
JavaVM* vm;
JNIEnv* en;
if (JNI_CreateJavaVM(&vm,(void**)&en,&arg)<0) {
MessageBox(NULL,"Error CreateJavaVM","jvm-Test",MB_OK);
return (1);
jclass clFrame=en->FindClass("Ljavax/swing/JFrame;");
if (clFrame==0) {
MessageBox(NULL,"Error FindClass","jvm-Test",MB_OK);
return (1);
jmethodID methodID=en->GetMethodID(clFrame,"<init>","(Ljava/lang/String;)V");
if (methodID==0) {
MessageBox(NULL,"Error GetMethodID","jvm-Test",MB_OK);
return (1);
int i2=availMem();
jobject window=en->NewObject(clFrame,methodID,en->NewStringUTF("Test"));
if (window==0) {
MessageBox(NULL,"Error NewObject","jvm-Test",MB_OK);
return (1);
int i3=availMem();
char o[256];
sprintf_s(o,"Available memory:\nStart: %d MB\nAfter CreateJavaVM: %d MB\nAfter JFrame: %d MB",i1,i2,i3);
MessageBox(NULL,o,"jvm-Test",MB_OK);
return (0);
I'am running on Windows XP with JDK 1.5.0_02 and get the following result:
Start: 1906 MB
After CreateJavaVM: 1558 MB
After JFrame: 1312 MB
I would expect that the available memory after constructing the Java object is similar to the available memory after creating the JVM. On Linux it is.
Thanks
a=null
MyClass a = new MyClass();
is the same as
MyClass a = new MyClass();
because after MyClass a = new MyClass(), doesn't point to a possible old instance but to a new instance of MyClass.
I guess, the problem is in some other data structure you build. perhaps the vector that contains lots of/big other objects? does any other class point to these objects too? remember: the garbage collector does clean up only unused memory, i.e. objects that are not referenced by any other objects that are valid (i.e. are referenced by the main thread or objects of the main thread).
Similar Messages
-
Problem with Java Memory "Could not reserve enough space for object heap"
Hi gurus,
I am not an expert with Java´s configuration, and I have a situation that I don´t understand. First of all, I am working at Centos 6.2 with jdk_1.6 and Tomcat 7.
The problem is...
- If I run Tomcat with JAVA_OPTS="-Xmx128m"* (at catalina.sh) all works fine.
- If I run Tomcat with JAVA_OPTS="-Xmx512m"* (at catalina.sh) an error appears:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
This appear when I run java -version or when I try to stop Tomcat, and the Tomcat isn´t able to stop.
The strange thing is that my server has more than 200M free in physical memory. So, why Tomcat isn´t able to stop? and Why Java doesn´t use the free memory in my server?
Thanks in advanced.Hello EJP, thanks for your answer.
I have explained bad.
The server has 703M free when Tomcat is stopped. I had mentioned that my server has more than 200M free in physical memory when Tomcat is running with JAVA_OPTS="-Xmx512m", so I don´t understand why these errors appear.
Do you understand me?
Recently I have checked the swap memory, and it is disabled. In spite of swap memory is disabled I think java wouldn´t need this memory because it has free physical memory
Thanks again. -
JVM 1.5.0, parallelism and object creation
Hi.
I am currently running Java 1.5.0 on a production server. This server is a 4-cpu 2gb ram beast running Red Hat ES 3. It provides MySQL backend and a Java server to be accessed through a Flash client.
So far, the Flash client fares well. MySQL takes worst cast 16% of one CPU for very heavy selections. But I am having problems with optimizing the Java part that does everything.
First and foremost, I cannot change the way it is. Our java code is mostly vendor code, thus we can't really expect to be able to easily change the code. Whatever code we added to the vendor code is definitely not the bottleneck, it's optimized, it's properly synchronized and it's very effective.
I would like to give you an idea of how things fares. You will see my problem soon.
- I am running one process of Java. This process is -Xms and Xmx'ed to 384 megs.
- The total DSize of the Java environment is more than a gigabyte due to the 1000+ threads that runs through it. More so, every client that runs through it adds up at least two threads.
- There are massive object creation and destruction happening. For a 100-client system, the "eden" memory is filled up and GC'ed at least twice per second. Since 1.5.0, the "old" memory of 384m gets filled up in 10 minutes, and GC'ed at that point.
- CPU usage is having fun between 80% and 150% of one CPU (remember I have 4 CPUs so 150% is 150/400% total usage)
- GC is the major speed bump for my server, as if I put 768 megs of Xmm instead of 384, cpu usage drops to 60%-90% CPU, that is, until memory gets filled up and swap gets used (do the math: 768m + 1200 thread stacks)
Now it works fine. 100 users, it's perfect. My major problem is that from next week on, we are planning 300+ users. Ouch.
So my few questions are:
- In knowing that garbage must constantly be collected, is there something I can do in the environment to make it happen all the time in background? Or am I bound to have all 4 cpu's stopped momentarily twice per second so that it might happen?
- In 1.4.x, I could change "eden" memory block size. It doesn't seem to be the same for 1.5.x. What's up with that? I used to increase it dramatically, making GC longer but less frequent, increasing parallelism force.
I am asking the questions because I am not in position of trying "what if"s with my production server. The test server handles well our 8 internal users ... but we are not close of making the same amount of request as our 100-users production server... so we cannot reliably try out options. Best case is see if it crashes or now.
Thanks
MikeMikle -- please make sure that you are using either the
UseParallelGC collector or the UseConcMarkSweepCollector.
Both would appear to address some of the problems you
mention.
You may need to tune the size of the young generation
explicitly. Check out the GC tuning documents/tips
at:
http://java.sun.com/docs/hotspot
You should make sure your application is not paging.
Since the default thread stack sizes are large (2 MB?)
and you may not need that much, you can try -Xss256k
(for example) to reduce the virtual memory requirements
for your thread stacks and free up more address space
for the Java heap.
In the end, for an application of the kind you describe you
probably need to go 64-bit and use a larger Java heap
along with the parallel/concurrent collector to deal with the
attendant GC overheads. That (going 64-bit) should be easy
(trivial) if your application is pure Java.
Hi.
I am currently running Java 1.5.0 on a production
server. This server is a 4-cpu 2gb ram beast running
Red Hat ES 3. It provides MySQL backend and a Java
server to be accessed through a Flash client.
So far, the Flash client fares well. MySQL takes worst
cast 16% of one CPU for very heavy selections. But I
am having problems with optimizing the Java part that
does everything.
First and foremost, I cannot change the way it is. Our
java code is mostly vendor code, thus we can't really
expect to be able to easily change the code. Whatever
code we added to the vendor code is definitely not the
bottleneck, it's optimized, it's properly synchronized
and it's very effective.
I would like to give you an idea of how things fares.
You will see my problem soon.
- I am running one process of Java. This process is
-Xms and Xmx'ed to 384 megs.
- The total DSize of the Java environment is more than
a gigabyte due to the 1000+ threads that runs through
it. More so, every client that runs through it adds up
at least two threads.
- There are massive object creation and destruction
happening. For a 100-client system, the "eden" memory
is filled up and GC'ed at least twice per second.
Since 1.5.0, the "old" memory of 384m gets filled up
in 10 minutes, and GC'ed at that point.
- CPU usage is having fun between 80% and 150% of one
CPU (remember I have 4 CPUs so 150% is 150/400% total
usage)
- GC is the major speed bump for my server, as if I
put 768 megs of Xmm instead of 384, cpu usage drops to
60%-90% CPU, that is, until memory gets filled up and
swap gets used (do the math: 768m + 1200 thread
stacks)
Now it works fine. 100 users, it's perfect. My major
problem is that from next week on, we are planning
300+ users. Ouch.
So my few questions are:
- In knowing that garbage must constantly be
collected, is there something I can do in the
environment to make it happen all the time in
background? Or am I bound to have all 4 cpu's stopped
momentarily twice per second so that it might happen?
- In 1.4.x, I could change "eden" memory block size.
It doesn't seem to be the same for 1.5.x. What's up
with that? I used to increase it dramatically, making
GC longer but less frequent, increasing parallelism
force.
I am asking the questions because I am not in position
of trying "what if"s with my production server. The
test server handles well our 8 internal users ... but
we are not close of making the same amount of request
as our 100-users production server... so we cannot
reliably try out options. Best case is see if it
crashes or now.
Thanks
Mike -
How much memory an object consumed?
Via making an internet lookup and writing some code, i made an implementation of
how to calculate how much memory an object consumes. This is a tricky way.
However, how can i achieve a better and direct way? Is there a tool for attaching
to JVM and viewing the memory locations and contents of objects in memory?
I wrote the tricky way to Javalobby and pasting the same explanation to here too.
I must say that this tricky way does not belong to me, and i noted where i took
the main inspiration etc. at the end.
Because of the underlying structure Java does not let
users to access and directly change the content of
instances in memory. Users could not know how
much memory is used for an object, like in C.
However this tricky method lets them to know in an
indirect way.
To achieve how much memory is used for an object we must
calculate the used memory before and after the object is
created.
MemoryUsage.java
* User: Pinkman - Fuat Geleri
* Date: Mar 20, 2005
* Time: 11:13:50 AM
* The class which makes the calculation job.
* Calculating the difference of used memory
* between calls
* "start()", and "end()".
* So if you initiate an object between those
* calls you can get how much memory the object
* consumed.
* Initial inspration from
* http://javaspecialists.co.za/archive/Issue029.html
public class MemoryUsage {
long usage;
public void start(){
garbageCollect();
Runtime r=Runtime.getRuntime();
usage=r.totalMemory()-r.freeMemory();
public long end(){
garbageCollect();
Runtime r=Runtime.getRuntime();
return (r.totalMemory()-r.freeMemory())-usage;
public String memorySizeToString(long l){
int MB=(int) (l/1048576);
l=l-1048576*MB;
int KB=(int) (l/1024);
l=l-1024*KB;
return new String(MB+"MB "+KB+"KB "+l+"BYTES");
private void garbageCollect() {
Runtime r=Runtime.getRuntime();
r.gc();r.gc();r.gc();r.gc();r.gc();
r.gc();r.gc();r.gc();r.gc();r.gc();
r.gc();r.gc();r.gc();r.gc();r.gc();
Therefore the first file MemoryUsage.java is coded.
It simply calculates and stores the used memory when
start() method is called. After generating some objects,
the end() method is called to get the
difference between memory usages, between the start()
and end() method calls.
SizeOf.java
import javax.swing.tree.DefaultMutableTreeNode;
import java.util.List;
import java.util.ArrayList;
import java.util.Random;
* User: Pinkman - Fuat Geleri
* Date: Mar 20, 2005
* Time: 6:02:54 PM
* Arbitrarily size of objects in JAVA..
* An example of getting how much an
* object consumed in memory.
* Like
* primitives -> does not consume any
* arrays -> consumes 16 bytes when empty
* ex: byte []a=new byte[0];
* list -> consumes 80 byte when empty..
* references -> when did not initiated does
* not consume any memory!.
* Initial inspration from
* http://javaspecialists.co.za/archive/Issue029.html
public class SizeOf {
MemoryUsage mu=new MemoryUsage();
public static void main(String []args){
SizeOf s=new SizeOf();
s.sizeOfExample();
//remove the comments in order to make the same checking by yourself..
private void sizeOfExample() {
mu.start();
//byte []b=new byte[0];//<-byte array 16byte,each byte addition equals 1 byte!!
//String s="How much memory is used?";//string consumes no byte!!
//byte c=20; //<-consumes no memory!!
//Object o=new Object();//object consumes 8 bytes..
//Object []oa=new Object[100];//<-object array consumes 16 byte! and each addition object 4 bytes!
//List list;//non initialized object consumes no memory!!..
//Integer i=new Integer(1);//an integer object consumes 16 bytes!
//List list=new ArrayList();//An array list consumes 80 bytes!.
/*for(int i=0;i<10;i++){ //An array list + 10 integer consumes 240 bytes :)
list.add(new Integer(i));
Random r=new Random();
byte []rand=new byte[1];
int count=100000;
List list=new ArrayList(count);
for(int i=0;i<count;i++){
r.nextBytes(rand);
list.add(new String(rand));//empty string occupies no memory??
DefaultMutableTreeNode root=new DefaultMutableTreeNode();//8 byte when single!.
Random r=new Random();
byte []rand=new byte[10];//when this is one and count is 1 million memory gets overfilled!..
int count=500000;
for(int i=0;i<count;i++){
r.nextBytes(rand);
root.add(new DefaultMutableTreeNode(new String(rand)));
long l=mu.end();
System.out.println(""+mu.memorySizeToString(l));
An example usage can be found in the second file
SizeOf.java. Simply remove the comments,"//", and execute
to see how much memory used.
For example:
% Primitives does not consume any memory.
% Non-initialized object references does not consume
any memory.
% Empty string and most of the small strings does not consume any memory.
% Empty byte[] consumes 16 bytes.
% Empty ArrayList consume 80 bytes.
% An Integer object consumes 16 bytes.
% Empty DefaultMutableTreeNode consumes 8 bytes..
and so on.
You can find the mentioned files in the attachments.
I heard the idea of -how much memory is used- from
Prof. Akif Eyler, and i got the main inspration from
the site http://javaspecialists.co.za/archive/Issue029.html
//sorry about my mistakes, and everything :)
Thanks for your answers beforehand.Any good profiler will tell you.
You can also code your own using jvmpi or jvmti.
Also note that calling System.gc is a hint to the jvm it may or may not respect your wish.
Test it with a few different gc algorithms and see what happens.
/robo -
Could not reserve enough space for object heap in Jdeveloper 11g R1
Hi,
I tried to increase the JVM heap size with Virtual machine = server and the value as -Xmx512m -XX:MaxPermSize=512M -Djbo.debugoutput=console in the project properties->Run/Debug/Profile->Default-Edit, but still getting the below error.
Any help is appreciated.
[waiting for the server to complete its initialization...]
JAVA Memory arguments: -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=512m
WLS Start Mode=Development
CLASSPATH=D:\Oracle\MIDDLE~1\patch_wls1032\profiles\default\sys_manifest_classpath\weblogic_patch.jar;D:\Oracle\MIDDLE~1\patch_jdev1111\profiles\default\sys_manifest_classpath\weblogic_patch.jar;D:\Oracle\MIDDLE~1\JDK160~1.5-3\lib\tools.jar;D:\Oracle\MIDDLE~1\utils\config\10.3\config-launch.jar;D:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic_sp.jar;D:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.jar;D:\Oracle\MIDDLE~1\modules\features\weblogic.server.modules_10.3.2.0.jar;D:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\webservices.jar;D:\Oracle\MIDDLE~1\modules\ORGAPA~1.0/lib/ant-all.jar;D:\Oracle\MIDDLE~1\modules\NETSFA~1.0_1/lib/ant-contrib.jar;D:\Oracle\MIDDLE~1\ORACLE~1\modules\oracle.jrf_11.1.1\jrf.jar;D:\Oracle\MIDDLE~1\WLSERV~1.3\common\eval\pointbase\lib\pbclient57.jar;D:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\xqrl.jar;d:\source\FCUBSInstaller.jar;D:\Olite10g_1\MOBILE\Sdk\bin\OLITE40.JAR;;
PATH=D:\Oracle\MIDDLE~1\patch_wls1032\profiles\default\native;D:\Oracle\MIDDLE~1\patch_jdev1111\profiles\default\native;D:\Oracle\MIDDLE~1\WLSERV~1.3\server\native\win\32;D:\Oracle\MIDDLE~1\WLSERV~1.3\server\bin;D:\Oracle\MIDDLE~1\modules\ORGAPA~1.0\bin;D:\Oracle\MIDDLE~1\JDK160~1.5-3\jre\bin;D:\Oracle\MIDDLE~1\JDK160~1.5-3\bin;D:\Olite10g_1\jre\1.4.2\bin\client;D:\Olite10g_1\jre\1.4.2\bin;D:\Software\oracle\product\10.2.0\client_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Windows Imaging\;D:\software\Clearcase 7.0\common;D:\software\Clearcase 7.0\ClearCase\bin;D:\Olite10g_1\MOBILE\sdk\bin;C:\Program Files\Liquid Technologies\Liquid XML Studio 2011\XmlDataBinder9\Redist9\cpp\win32\bin;D:\Software\Liquid Technologies\Liquid XML Studio 2011\XmlDataBinder9\Redist9\cpp\win32\bin;D:\software\oracle10g\BIN;D:\Jdev10g\jdk\bin;;D:\Oracle\MIDDLE~1\WLSERV~1.3\server\native\win\32\oci920_8
* To start WebLogic Server, use a username and *
* password assigned to an admin-level user. For *
* server administration, use the WebLogic Server *
* console at http:\\hostname:port\console *
starting weblogic with Java version:
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode)
Starting WLS with line:
D:\Oracle\MIDDLE~1\JDK160~1.5-3\bin\java -client -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=128m -XX:MaxPermSize=512m -Dweblogic.Name=DefaultServer -Djava.security.policy=D:\Oracle\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.policy -Djavax.net.ssl.trustStore=D:\Oracle\Middleware\wlserver_10.3\server\lib\DemoTrust.jks -Xmx512m -XX:MaxPermSize=512M -Djbo.debugoutput=console -Dweblogic.nodemanager.ServiceEnabled=true -Xverify:none -da -Dplatform.home=D:\Oracle\MIDDLE~1\WLSERV~1.3 -Dwls.home=D:\Oracle\MIDDLE~1\WLSERV~1.3\server -Dweblogic.home=D:\Oracle\MIDDLE~1\WLSERV~1.3\server -Djps.app.credential.overwrite.allowed=true -Ddomain.home=C:\DOCUME~1\ANURAD~1\APPLIC~1\JDEVEL~1\SYSTEM~1.36\DEFAUL~1 -Dcommon.components.home=D:\Oracle\MIDDLE~1\ORACLE~1 -Djrf.version=11.1.1 -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Jdk14Logger -Djrockit.optfile=D:\Oracle\MIDDLE~1\ORACLE~1\modules\oracle.jrf_11.1.1\jrocket_optfile.txt -Doracle.domain.config.dir=C:\DOCUME~1\ANURAD~1\APPLIC~1\JDEVEL~1\SYSTEM~1.36\DEFAUL~1\config\FMWCON~1 -Doracle.server.config.dir=C:\DOCUME~1\ANURAD~1\APPLIC~1\JDEVEL~1\SYSTEM~1.36\DEFAUL~1\config\FMWCON~1\servers\DefaultServer -Doracle.security.jps.config=C:\DOCUME~1\ANURAD~1\APPLIC~1\JDEVEL~1\SYSTEM~1.36\DEFAUL~1\config\fmwconfig\jps-config.xml -Djava.protocol.handler.pkgs=oracle.mds.net.protocol -Digf.arisidbeans.carmlloc=C:\DOCUME~1\ANURAD~1\APPLIC~1\JDEVEL~1\SYSTEM~1.36\DEFAUL~1\config\FMWCON~1\carml -Digf.arisidstack.home=C:\DOCUME~1\ANURAD~1\APPLIC~1\JDEVEL~1\SYSTEM~1.36\DEFAUL~1\config\FMWCON~1\arisidprovider -Dweblogic.alternateTypesDirectory=D:\software\oracle\product\10.2.0\client_1\modules\oracle.ossoiap_11.1.1,D:\software\oracle\product\10.2.0\client_1\modules\oracle.oamprovider_11.1.1 -Dweblogic.jdbc.remoteEnabled=false -Dwsm.repository.path=C:\DOCUME~1\ANURAD~1\APPLIC~1\JDEVEL~1\SYSTEM~1.36\DEFAUL~1\oracle\store\gmds -Xms512m -Xmx512m -Dweblogic.management.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=D:\Oracle\MIDDLE~1\patch_wls1032\profiles\default\sysext_manifest_classpath;D:\Oracle\MIDDLE~1\patch_jdev1111\profiles\default\sysext_manifest_classpath weblogic.Server
Error occurred during initialization of VM
Could not reserve enough space for object heap
Process exited.This is telling you that there is not enough memory for the heap size you've specified. Increasing the heap size makes this worse, not better. You need more physical memory.
john -
I want to test the input parameters to a constructor and determine if an invalid parameter has been supplied.
If I use:
Thingy myThingy = new Thingy("invalid value");
is it up to the programmer of the above to catch the error, either through exception handling or some other form of error checking, and perform
myThingy = null;
to render the partially initialized object ready for garbage collection?
Is there a way in the constructor itself to indicate that the object shouldn't be created and null should be returned as the result of the "new" operation?
Thanks,
JohnBut I'd say Clem1986 still has a point. Even in the constructor
Foo() throws Exception {
throw new Exception("Bollocks");
}there's the implicit call to super() and instance initializers before you arrive at throw. From JVM spec: The new instruction does not completely create a new instance; instance creation is not completed until an instance initialization method has been invoked on the uninitialized instance. Which is done above. Whether this qualifies in OP's context as completing instance creation or instantiating an object I don't know. But you could work with it in the constructor, and once you get to throw, memory has been allocated, all superclasses have been initialized (which might involve heavy allocation/computation), default values were assigned to fields and instance initializers have executed. Only now can you decide to "abort new object creation" by completing abruptly and not "returning" the reference to the newly-(partially-)created object to the caller. -
Excel remains in memory after using by DOI.
Hi.
I'm trying to use DOI but
Excel instance remains in memory after I have run macro and leave program. If I don't run any macro - everything is Ok.
I run macro by this way:
CALL METHOD document->execute_macro
EXPORTING
macro_string = 'MyMacro'
param_count = 0
IMPORTING
error = error.
Before leaving the program I release DOI objects as in demo
IF NOT documentproxy IS INITIAL.
CALL METHOD documentproxy->close_document.
CALL METHOD c_oi_errors=>show_message
EXPORTING
type = 'E'.
FREE documentproxy.
ENDIF.
IF NOT olecontrol IS INITIAL.
CALL METHOD olecontrol->destroy_control.
FREE olecontrol.
ENDIF.
Thanks for your help.
Mike Menkov.Hello, long time no see,
but anyway, executing a macro prevents excel then to be closed over ole, as i've tried many ways to get it done, here is a work-around.
it's frustating that I cannot use excel as Inplace there, because users could then easily USE or even UPLOAD their own excel-spreadsheets over the custom control with the use of ALV-Grid firstly, wich is really nice. Because of this 'bug', (i think it definitely is one, but don't know on wich side, MS or SAP) excel-spreadsheet functionality over ALV-Grid imho simply cannot be used fine with spreadsheets containing 'bigger' macros which where executed over ole - in eo_start_macro.
For closing this issue, I just wanted to add how I could 'overcome' the sympthoms of this still remaining temp-files (+excel holding them open) when using excel + ole automation over SAPGUI:
You could just NOT use excel "Inplace" on a custom control of a dynpro, but outside SAP, still OLE-driven.
Start it in foreground guarantees you can close the temp-file with or without saving at a time and not surprisingly at the end on shutdown, because the controls of excel (and excel as a whole) are visible anytime - ole automation works also fine this way.
This is the order of preparing excel and setting data into it i've done it, therefore i've created a single include for all the excel-ole stuff:
(complete source could be looked up at http://pastebin.com/zmr6xdZm)
1.eo_get_templ_uri
2.eo_build_spreadsheet_interface - goes ahead with parameter inplace_enabled = SPACE
3.eo_build_named_area
4.eo_set_data_into_sheet
5.eo_start_macro
after the data is sent to excel (+ the macro on the spreadsheet has done it's job), excel is holding the filled temp file (spreadsheet) in foreground, so users can directly close it with- or without saving.
*** using inplace_enabled = SPACE here, on Initializing the control
CALL METHOD cl_control->init_control
EXPORTING
inplace_enabled = ' '
no_flush = 'X'
INPLACE_SHOW_TOOLBARS = insert_toolbar
r3_application_name = sy-cprog
parent = cl_container
IMPORTING
error = error
EXCEPTIONS
* javabeannotsupported = 1 " ex. nicht im Minisap
OTHERS = 2.
*** and on Load document from BOR
CALL METHOD cl_document->open_document
EXPORTING
"startup_macro = 'DieseArbeitsmappe.start' "funkt nicht
document_title = sy-cprog
document_url = doc_url
no_flush = 'X'
open_inplace = ' '
IMPORTING
retcode = soiret
error = error.
APPEND error TO t_errors.
ENDIF.
Cheers,
David -
Xdb_installation_trigger does not support object creation of type SNAPSHOT
hi everyone, i'm using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit on solaris sparc 5.10
we like to send an email through SSL, and after searching here and there I found out that oracle DB 11g able to go throught the SSL.
since upgrade our DB to 11g would not be an option, so i tried to export XDB of 11g and import it into XDB 10gR2 schema, it was a mess...
then i just reinstall XDB using catnoqm.sql & catqm.sql
and now one of our programmer cant run some script like above
CREATE MATERIALIZED VIEW FIFSYS_MKT_SCHEME_MV_COY
TABLESPACE MARKETING_TABLES
PCTUSED 40
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
FREELISTS 1
FREELIST GROUPS 1
BUFFER_POOL DEFAULT
+)+
NOCACHE
LOGGING
NOCOMPRESS
NOPARALLEL
BUILD IMMEDIATE
REFRESH FORCE ON DEMAND
WITH PRIMARY KEY
AS
+/* Formatted on 9/23/2010 1:07:42 PM (QP5 v5.114.809.3010) */+
SELECT coy_id,
appl_branch_id,
appl_object_code,
product_type,
ppdcf_paid_date,
SUM (scheme_adm) scheme_adm,
SUM (appl_unit) appl_unit,
SYSDATE mkt_sysdate
FROM (SELECT NVL (a.coy_id, '01') coy_id,
a.branch_id appl_branch_id,
DECODE (a.buss_unit, 'NMC', '2101', 'UMC', '2102', '2352')
appl_object_code,
a.platform product_type,
TRUNC (c.contract_active_date) ppdcf_paid_date,
NVL (s.ms_amt, 0) scheme_adm,
NVL (o.total_item, 0) appl_unit
FROM ordmgmt.om_trn_appl_ms_lvl_object s,
ordmgmt.om_trn_appl_hdr a,
acctmgmt.ar_trn_sum_contracts c,
+( SELECT appl_no, COUNT ( * ) total_item+
FROM ordmgmt.om_trn_appl_object
GROUP BY appl_no) o
WHERE s.appl_no = a.appl_no
AND a.appl_no = o.appl_no
AND s.ms_code IN ('MS03', 'MS14')
AND c.appl_no = a.appl_no
AND c.contract_no = a.contract_no
+/*AND c.office_code = a.branch_id*/+
AND NVL (a.coy_id, '01') = NVL (c.coy_id, '01'))
GROUP BY coy_id,
appl_branch_id,
appl_object_code,
product_type,
ppdcf_paid_date;
COMMENT ON MATERIALIZED VIEW FIFSYS_MKT_SCHEME_MV_COY IS 'snapshot table for snapshot MARKETING.FIFSYS_MKT_SCHEME_MV_COY';
and this error shown:
ORA-00604 error occurred at recursive SQL level 1
ORA-20000 Trigger xdb_installation_trigger does not support object creation of type SNAPSHOT
ORA-06512 at line 32
maybe some of you know how to solve this problem??
and, this in the script of the xdb_installation_trigger
DROP TRIGGER SYS.XDB_INSTALLATION_TRIGGER;
CREATE OR REPLACE TRIGGER SYS.xdb_installation_trigger
BEFORE
CREATE ON DATABASE
DECLARE
sql_text varchar2(200);
val number;
BEGIN
if (dictionary_obj_owner != 'XDB') then
if (dictionary_obj_type = 'FUNCTION' or
dictionary_obj_type = 'INDEX' or
dictionary_obj_type = 'PACKAGE' or
dictionary_obj_type = 'PACKAGE BODY' or
dictionary_obj_type = 'PROCEDURE' or
dictionary_obj_type = 'SYNONYM' or
dictionary_obj_type = 'TABLE' or
dictionary_obj_type = 'TABLESPACE' or
dictionary_obj_type = 'TYPE' or
dictionary_obj_type = 'VIEW' or
dictionary_obj_type = 'USER'
+)then+
if (dictionary_obj_type != 'PACKAGE BODY'
+) then+
sql_text := 'select count(*) from ALL_OBJECTS where owner = :1 and object_name = :2 and object_type = :3';
execute immediate sql_text into val using dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type;
if (val = 0) then
sql_text := 'select count(*) from dropped_xdb_instll_tab where owner = :1 and object_name = :2 and object_type = :3';
execute immediate sql_text into val using dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type;
if (val = 0) then
insert into xdb_installation_tab values
+(dictionary_obj_owner, dictionary_obj_name, dictionary_obj_type);+
end if;
end if;
end if;
else
raise_application_error(-20000, 'Trigger xdb_installation_trigger does not support object creation of type '||dictionary_obj_type);
end if;
end if;
end;
+/+
/********************************************************************************/i'm so careless, after checking a fresh installation of the same version DB, i dont found xdb_installation_trigger.
so just by simply remove that trigger & everything works just fine. :) -
Account of the opportunity is not populated after the creation of a task
Hi,
In our project, we are using the Opportunity Object after the creation of a task. Our tasks are always related to an existing account.
I was wondering why when I create an opportunity from a task, the field "Account Name" is not populated by default with the account name related to the task.
Any ideas?
Regards,
Dara
Edited by: user6469826 on 2 août 2011 11:40Contact an electronics repair shop.
-
Hello
Please tell me what is the difference between these two object creation of string.
String str = new String("Hello");.
String str="Hello";
Thanks.RGEO wrote:
hello,
Is the string pool is part of a heap? Huh? I suppose yes, you could regard the String pool as part of the heap... but (I guess) that interned String objects would be placed directly into the permanent generation, which is not garbage collected... and therefore I don't really think of the permanent generation as part of the heap (except when tuning heap allocations)... but I think I'm talking over your noob head here, yes... and so to the noob-stuff.
If you get bored you might like to scan (for now) http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html#generations ... and come back to it in a couple of years time (when every second word isn't new and baffling to you;-)
jvm what will do when he encounter the following code,
String s1 = new String ("hello");The VM will:
1. Create a new String object, and then
2. copy the characters 'h','e','l','l','o' from the interned String "hello" to the new String,
3. and then assign a reference to the new String to variable s1.
Note that the result is subtley different from String s1 = "hello", which just does step 3... it assigns a reference to the existing interned String object "hello" to the variable s1... it does not create and "populate" a new String object.
Try this just for fun... what is the output of the following program? Why?
package forums;
public class StringEquals
public static void main(String[] args) {
try {
String a = "Hello";
String b = "Hello";
System.out.println("a==b is "+(a==b));
String c = new String("Hello");
System.out.println("a==c is "+(a==c));
} catch (Exception e) {
e.printStackTrace();
}Now, what's the correct way to evaluate equality of String objects in Java?
HTH. Cheers. Keith. -
Error initialization of VM, not reserve enough memory
Basically i am trying to create a cgi program which opens a filehandle to capture the output of a java program (which outputs 6 simple strings), these strings are then placed into an array and printed to the browser as below:
open(THIS_J, "/usr/j2se/bin/java Testjprob|");
while (<THIS_J>) {
unshift(@array,$_);
close(THIS_J);
$length = scalar(@array);
if($length != 0){
print $q->p("The Search Returned No $array[3]");
}The java works when i execute it on the command line through a perl program, however, it doesnt work when i execute it through a cgi program. So i put a test in the perl program to see what version the java is when running:
system "/usr/j2se/bin/java -version > jprobversion.txt" || die "$!";and i looked in the jprobversion.txt and expected to see version numbers etc... instead this message appeared :
"Error occurred during initialization of VM
Could not reserve enough space for object heap"
I have spoken to a few people about this and they came to the conclusion that it is due to the differences in enviornment between running java under cgi and on the command line. I got a response back from a person who mentioned:
"The error message immediatly follows a mmap for 134217728 bytes.
There is no edquivalent mmap when run from the command line."
What is mmap and has anyone else ever come across a problem like this before? Is it just a case of setting an environment variable?This could be a problem with virtual memory soft limits in the shell that perl exec's. Try this test. Make a test script that does this:
system("ulimit -Ha > /tmp/ul.out 2>&1");
system("ulimit -Sa >> /tmp/ul.out 2>&1");
For comparison, from your command line run:
ulimit -Ha; ulimit -Sa
Look at the resulting output. The line you're interested in is:
virtual memory (kbytes, -v) <some value here>
If the virtual memory size for -Ha in the script is > the size for -Sa then you should be able to increase your virtual memory limit like so in your script:
# increase stack to 64M, if hard limit is 'unlimited' then you could substitue
# the word 'unlimited' for 64000 or the word 'hard'. Check the various man pages
# for ulimit, bash, sh etc.
system("ulimit -Ss 64000; /usr/j2se/bin/java ....");
bill -
Hi ,
Static Object Creation :
Eg:
<mx:Fade id="ViewStack_EffectStart" duration="500" alphaFrom="0.0" alphaTo="1.0"/>
<mx:Fade id="ViewStack_EffectEnd" duration="500" alphaFrom="1.0" alphaTo="0.0"/>
<comp:ErrorBox id="errorBox" active="{active}" showEffect="{ViewStack_EffectStart}" hideEffect="{ViewStack_EffectEnd}"/> .
The above static objects is working fine, but the problem is that we have lot of similiar static object which creates a memory issue.If we create dynamic objects, will it avoid the issue.Is dynamic objects advisible?.
Thanks in advance.Please reply ASAP.
Thanks ,
San.hmn.. I don't understand your questions fully.
What about create the fade object in "Model" and reference the same Fade object for all dynamic objects?
or r u asking to find out how to create fade in actionscript?
var fade:Fade = new Fade();
fade.target = this;
fade.alphaFrom = 0;
fade.alphaTo = 1;
fade.play();
hope this helps,
BaBo, -
Oracle 8i Lite: Command Object Creation Failed
Hi Everyone,
I use Windows XP everything works except navigator and I get the message that Command Object Creation Failed
Does Anyone know how to fix this and I have to use 8i Lite as it for a school database project
Thanks in advance for everyone's help
J SHi. I know this response is too many years late, but I'm putting it in case someone (like me a few days ago) needs to connect to a legacy server using legacy tools:
This error is caused by the installer, sometimes it does not adequately register the OLE/COM objects provided in nav8cmd.dll
So, to correct it:
- open a command window
- change to the directory where the navigator program files reside (In my case c:\orant\bin)
- type the following command: regsvr32 nav8cmd.dll
You should receive a message that the DLL was correctly registered. After that you can use the navigator without problems.
Cheers. -
Free memory after Function call
Hi,
Is there a possibility to free the memory after a call to a function.
The call is only used for display, not to get data.
(For example - CALL FUNCTION 'FKK_BUPA_DISPLAY')
Our z-transaction delivers a way of navigating through different ISU objects (coming from an ALV list)
The user first selects a case from this list and then he receives the details. From the details screen we then call these standard function to display the ISU objects.
During the day memory usage is getting build up and it's only released when the user leaves our z-transaction.
Ideally the memory should be released when the user returns to the list and not at the end of the day when he leaves the transaction.
I've tried with FREE MEMORY but this doesn't help.
Greetings,
IvoHi Ivo,
sounds like a "enldess transaction" pattern.
Take multiple memory snapshots (OK-CODE /HMUSA) in your application and compare
these in transaction S_MEMORY_INSPECTOR in order to find out if there is a memory
leak. The comparison will show you where memory growth comes from... maybe this gives
you an idea what could be deleted between the steps of your endless transaction.
Kind regards,
Hermann -
Free memory after TDMS logging
Hi, how can I free memory after reading TDMS files. I haev a very big TDMS file that contains 17000000 digital samples, after reading the data and graphing it I would like to delete it from memory because it is no longer needed. I have noticed I should close LabVIEW to free that space. Is there any way to free that memory after reading and plotting?
ThanksLabVIEW wil take care of the memory management. Thus, there is no explicit way for you to free memory in LabVIEW. In fact, I don't think you should do that by yourself. LabVIEW has quite good memory optimation strategy and it wll track all the memory usage in your VI and reuse/free memory when there is no reference to it. As for TDMS, once the data is read out from the TDMS VIs, there will be no additional data copy inside.
Maybe you are looking for
-
I jus got a MacBook pro and Im having trouble connecting to my schools network. It is not secured and only requires to login with school id. A Window pops up to sign in but it never loads anyone know why I'm having this problem? Doesn't have a proble
-
Hello, I've read the "understanding MSTP article" from cisco's website and I have several uncertainties. These have deepened even more after performing several experiments. I've setup a test scenario with the following configuration: C1 Cisco PVST --
-
MacPro in Canada Needs More Ram...
Yes, I'm here in Canada. I'm wanting to add more memory to the stock 1GB that came with my MP. There arent alot of options for shopping, therefore I've turned to two sites. OWC and Ramjet. Which in your opinion is the better of the two? They both see
-
Dear All; I am new to ADF security, my target is to create a web application, with authentication through a login page, and session tracking through out the users session, i used to do this all in code, the JSP way, where i check the session in every
-
JTable custom grid line painting
In my JTable, I need to change the appearance of the line between two cells (either making it into a dashed line or just changing the color, the latter probably being easier). I am currently planning to turn off the JTable's grid lines and paint my o