| View previous topic :: View next topic |
| Author |
Message |
MakuG General User

Joined: 03 Feb 2004 Posts: 10
|
Posted: Wed Dec 08, 2004 5:33 am Post subject: memory leakage |
|
|
Hi Christian,
30 times may not be enough. See the c# example for details: | Code: | using System;
using System.Reflection;
namespace DefaultNamespace
{
class MainClass
{
static object Invoke(object obj,string method, params object[] par)
{
return obj.GetType().InvokeMember(method,BindingFlags.InvokeMethod,null,obj,par);
}
public static void Main(string[] args)
{
object usm=Activator.CreateInstance(Type.GetTypeFromProgID("com.sun.star.ServiceManager"));
object desk=Invoke(usm,"createInstance","com.sun.star.frame.Desktop");
for(int i=0;i<1000;++i)
{
object calcDoc=Invoke(desk,"loadComponentFromURL","private:factory/scalc","_blank",0,new object[0]);
Invoke(calcDoc,"close",true);
}
}
}
}
|
Oliver |
|
| Back to top |
|
 |
MakuG General User

Joined: 03 Feb 2004 Posts: 10
|
Posted: Wed Dec 22, 2004 6:05 am Post subject: |
|
|
Hi all,
Here in the forum there are a couple of "memory leak" posts. One tells something about an issue at issuezilla (14349). There it is been said that the cause for mem leaks may lay in the garbage collector and will be fixed with OpenOffice2.0. I tried it again with the c# example given in my last post on OpenOffice1.1.4 but found the same leakage.
Oliver |
|
| Back to top |
|
 |
shibu General User


Joined: 16 Dec 2004 Posts: 6
|
Posted: Thu Dec 30, 2004 11:37 pm Post subject: |
|
|
| Is there any one who has tried it with coldfusion |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Fri Dec 31, 2004 1:33 pm Post subject: |
|
|
shibu: No, do you want to try and test it? If so you're more than welcome to do some pioneering work on that. And if you got it working please let me know and I will add it to the list - of course saying that it comes from you.
MakuG: That's not good . I hate mutex anyway.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
shibu General User


Joined: 16 Dec 2004 Posts: 6
|
Posted: Fri Dec 31, 2004 11:05 pm Post subject: |
|
|
I will surely post it to you If I succeed.
Just one more point to ask about.
I tried the "hello world " example with the cold fusion using the same procedure as you have explained for vb & PHP. The problem is that when I try to execute the code it is getting stuck. ie. no result was displayed (The browser was not showing the done mode) even after waiting for hours.
Please explain what this could be?
Also I tried the same procedure with ASP, it ended up with the same result as above.
Folowing are my code.
ASP :
| Code: | <%
Dim objServiceManager 'As Object
Dim objDesktop 'As Object
Dim args()
Set objServiceManager= Server.CreateObject("com.sun.star.ServiceManager")
Set Stardesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
Set doc = Stardesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
Set text = doc.getText()
text.setString("Hello World")
%> |
COLDFUSION :
| Code: | <CFSET oAgrs = ArrayNew(1)>
<CFOBJECT action="connect" name="objServiceManager" class="com.sun.star.ServiceManager" >
<CFSET Stardesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")>
<CFSET doc = Stardesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, oArgs )>
<CFSET text = doc.getText() >
<CFSET text.setString("Hello World")> |
I believe, I have installed all that is required to do the COM Programming for Openofice.
Please suggest. |
|
| Back to top |
|
 |
sujata General User

Joined: 21 Feb 2005 Posts: 5
|
Posted: Wed Apr 20, 2005 2:17 pm Post subject: Re: Using COM for OOo with different languages |
|
|
[quote="Cybb20"
can u tell me the exact compile options to be used while compiling the C++ program with GCC ( openoffice access through C++ code sent by u )
m geting error as
'VTable not a member of structure'
guess m not including some headers... so pls help
thanks
regards
sujata |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Thu Apr 21, 2005 2:04 am Post subject: |
|
|
Hi sujata, as I pointed out in my email to you, it is important that you are on the correct platform, here it means that you need to have Windows NT or above running (Windows 98 might also work).
Another thing is that you need to have the Win32 API library and the necessary header files, those do already come together with MS Visual Studio but since you're trying to compile it with GCC, you need to explicitly download them (www.mingw.org has a Win32API package for example).
The C I posted was actually written and tested for MinGW (GCC).
And please note that the given example is in C, it is not necessarily working for C++, since some structures have changed or have become classes (MFC).
And I know there is a difference between the vtable in the C++ and C version.
It's up to you to find the differences, otherwise if this doesn't give you the desired information to find it out on your own, I am willing to help you finding it out.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
MikoOO Newbie

Joined: 26 May 2005 Posts: 1 Location: France
|
Posted: Thu May 26, 2005 1:10 pm Post subject: Tcl Code |
|
|
Hi,
This Tcl code works for me (tested with tclsh and freewrap)
package require tcom
set OO [::tcom::ref createobject "com.sun.star.ServiceManager"]
set OD [$OO createInstance com.sun.star.frame.Desktop ]
array set arguments {}
set doc [$OD LoadComponentFromUrl private:factory/scalc _blank 0 [parray arguments]]
You were missing "[parray arguments]"...
Nice post anyway.. _________________ Tcl is good for you |
|
| Back to top |
|
 |
Rau Newbie

Joined: 06 Aug 2005 Posts: 2
|
Posted: Sat Aug 06, 2005 6:56 pm Post subject: How can I do this with Oracle Developer? |
|
|
How can I do this with Oracle Developer?
Someone know´s how to do this thing happen´s? _________________ Rau ´-) |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Sun Aug 07, 2005 11:47 am Post subject: |
|
|
MikoOO:
Thanks you so much, I will update the Tcl example right in a minute with your correction.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
hinek General User


Joined: 21 Jun 2005 Posts: 10 Location: Germany
|
Posted: Thu Aug 25, 2005 1:28 am Post subject: |
|
|
I'm working with C# ... opening a SXW, printing and closing it.
Sometimes the code works fine, sometimes it trows this exception:
Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80004005): InterfaceOleWrapper_Impl::doInvoke :
Unexpected exception
Some idea, what it could be? |
|
| Back to top |
|
 |
shevegen Newbie

Joined: 14 Nov 2003 Posts: 4
|
Posted: Thu Aug 25, 2005 5:52 pm Post subject: |
|
|
| Is this all only possible on Windows Platforms? |
|
| Back to top |
|
 |
hinek General User


Joined: 21 Jun 2005 Posts: 10 Location: Germany
|
Posted: Fri Aug 26, 2005 1:45 am Post subject: |
|
|
Ok, I found the problem:
I changed the Registrykey of the ServiceManager from
C:\Program Files\OpenOffice.org1.1.4\program\soffice.exe -nodefault -nologo
to
C:\Program Files\OpenOffice.org1.1.4\program\soffice.exe -nologo
Now it works, but I don't know why or even know what the -nodefault trigger does.
Ok, another question: is there a debug mode in OOo 1.1.4, that I can activate and that logs everything to a file or to the windows eventlog ... that would help me, finding errors in future.
Thx for everything ... |
|
| Back to top |
|
 |
hinek General User


Joined: 21 Jun 2005 Posts: 10 Location: Germany
|
Posted: Fri Aug 26, 2005 1:48 am Post subject: |
|
|
| shevegen wrote: | | Is this all only possible on Windows Platforms? |
Yes COM Automation is only avaible for Windows Platforms ...
But maybe there are ways to automate OOo in other OS ... I don't know. |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Fri Aug 26, 2005 8:08 am Post subject: |
|
|
There is no debug mode, if you don't build OOo yourself with debug=true, or you use strace. mayber you also have a COM debugger in your C# environment (VisualStudio has one). _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
|