Thanks to the explanation by Andrew Douglas Pitonyak and Mathias Bauer.

Scope: global vs. local vs. any other
Are all objects returned by CreateUnoService() global objects and therefore not 
to be disposed of by users?  If the answer is dependent on the exact service 
requested, is there a documentation specifying which are global and which are 
other types?  I tried the Developers Guide, version 2.0, and a few OO mail 
lists.  Not much luck so far.

FunctionAccess:
Is the FunctionAccess service object returned by CreateUnoService() a pointer 
to a singleton object, that is, the actual singleton FunctionAccess service 
object?

Memory management (leakage):
Is the memory automatically reclaimed (at an unspecified time) when the service 
objects go out of scope?
Is the memory management guideline independent of the script languages (Basic, 
Java-BeanShell, etc.)

There is no concern for memory leakage if all service objects returned by 
CreateUnoService() are mere pointers (handles) to the real (global) service 
objects.

Efficiency:
The overhead of CreateUnoService() becomes noticeable when the repetition 
approaches 100000 - 1000000 (1 million) in Basic on MS Windows 2000.

Regards,


' --- example code in OO Basic 1.9.95
option explicit

' simulate repetitive calls from sheet cells to CreateUnoService()
' assume 10 - 20 calls to built-in sheet functions to satisfy one cell request
' assume the same number of calls to CreateUnoService() due to the partition of 
algorithm logic 
Sub test_01()
dim ii as long, cnt as long, err as long
cnt = 1000000
for ii = 0 to cnt step 1
  err = call_sheet_functions()
  next
msgbox( "call_sheet_functions() repeats " & cnt )
End Sub


function call_sheet_functions() as long
Dim oFunction as variant
oFunction = CreateUnoService("com.sun.star.sheet.FunctionAccess")

' data processing section, call sheet built-in functions

call_sheet_functions = 0
end function

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to