Lifetime of Object in the Object Cache on selects

On inserting an object (corresponding to user-defined SQL type), I can use a stack-allocated struct for the object and its indicator structure, and pass these addresses to OCIBindObject.
But on selecting an object (by value, not ref), the doc says one must let the OCI runtime allocate the object struct and its indicator struct in the Object Cache, and call OCIObjectFree when done with the object. But it's unclear whether one needs to free the object for each row of the result set processed, or only once all rows have been processed.
By looking at the cache-allocated addresses of the object/indicator structs, it looks like the same "instance" in the cache is re-used for every row (addresses remain the same for every row). This tends to indicate the same object is reused, as opposed to a new one being allocated. I added a single OCIObjectFree after processing all rows, and things look OK... (read no crash, no complain/error from OCI).
But I feel a little uneasy about this, because unlike in my case, when the object has secondary allocations associated to it (because the type contains strings, collections, or other objects members), if somehow I need to OCIObjectFree for each row, and I don't, then I'm leaking all the secondary storage from previous instances of the object.
Can someone please shed some light on the subject? I find the OCI doc often a little sketchy on these very important lifetime issues. I'd appreciate some advice from someone with Object-Relational aspects of OCI.
Thanks, --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

when I have to select objects by value :
* I let oci allocate objects in the object fetch arrayI don't think we have a choice here in fact. At least the way I interpret the doc.
* I have different addresses for every entry in the array after the fetchBut even an array fetch is done is a loop. You fetch 10 rows at a time, and you get say 25, so you have 3 iterations / fetches.
Of course the 10 object entries of a given fetch are different, but is the address of the 6th object the same in the first, second, and third fetch?
* I call OCIObjectFree() for every entry of the
array.If I have retreived object based attributes
from the object, i call OCIObjectFree() on the
object attributes recursively.To made it easier to understand my question, please find below the pseudo-code of what I'm doing (all error checking and most boiler plate arguments OCI requires are omitted, to concentrate on the control flow and the calls made)
create type point_typ as object (
  x binary_float, y binary_float, z binary_float
create table point_typ_tab (
  id number, point point_typ
struct point_typ { // C-struct matching SQL User Type
    float x, y, z;
struct point_ind { // indicator structure for point_typ
    OCIInd self, x, y, z;
static void select_objects() {
    Environment env(OCI_OBJECT);
    env.connect(zusername, zpassword, zdatabase);
    OCIHandleAlloc(OCI_HTYPE_STMT);
    OCIStmtPrepare("SELECT id, point FROM point_typ_tab");
    ub4 id = 0; OCIDefine* define_id = 0;
    OCIDefineByPos(&define_id, 1, &id, sizeof(id), SQLT_UIN);
    OCIDefine* define_pt = 0;
    OCIDefineByPos(&define_pt, 2, 0, sizeof(point_typ), SQLT_NTY)
    OCIType* point_typ_tdo = 0;
    OCITypeByName("POINT_TYP", OCI_DURATION_SESSION,
        OCI_TYPEGET_ALL, &point_typ_tdo);
    point_typ* p_pt = 0;     ub4 pt_size = 0;
    point_ind* p_pt_ind = 0; ub4 pt_ind_size = (ub4)sizeof(point_ind);
    OCIDefineObject(define_pt, point_typ_tdo,
        (void**)&p_pt, &pt_size, (void**)&p_pt_ind, &pt_ind_size);
    sword rc = OCIStmtExecute(0/*row*/);
    while (OCIStmtFetch2((ub4)1/*row*/, OCI_FETCH_NEXT) has data) {
        if (p_pt_ind->self == OCI_IND_NOTNULL) {
            // Use p_pt. Value of p_pt same for all iteration
    OCIObjectFree(p_pt);
    OCIHandleFree(OCI_HTYPE_STMT);
}As you can see, I do a single OCIObjectFree after the loop, and as mentioned previously, p_pt's value (a point_typ address) remains identical during the iteration, but the values in that memory chunk do change to reflect the various point instances (so each point instance overlays the previous one).
Are you saying I should be calling OCIObjectFree(p_pt); inside the loop itself?
And if so, should I call OCIObjectFree(p_pt); even if the indicator tells me the point is atomically null?
That what I do in OCILIB, and it doesn't seem to leak.Reading your post, I'm unsure you free of points in the array after the loop, or inside the loop. I hope the pseudo-code I posted above help to clarify my question.
BTW, OCCI is just a wrapper around OCI. Because OCCI
first releases were buggy (it's getting better) and
just few compilers (and compilers versions) are
supported, OCI remains a portable and workable
solution for dealing with Oracle ObjectsAs I wrote in a separate reply in this thread, I also agree OCI is the way to go, for various reasons.
Thanks for the post. I'd appreciate if you could confirm or not whether what I'm doing is consistent with what you are doing in OCILIB, now that I'm hopefully made my question clearer.
Thanks, --DD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Webutil_file_transfer url_to_client places objects in the Java Cache

    Hi,
    I'm using webutil_file_transfer url_to_client to download a PDF file.
    Once I downloaded the PDF file, it is visible in the Client Java Cache Viewer. When I try to run the download again webutil takes the PDF from the Cache instead taking the newer PDF from the Server where the URL is pointing to.
    So the URL I passing is each time the same, but the PDF file on the Server is getting updated very often.
    I don't usethe WEBCACHE port!
    My question now is. Can I avoid webutil to put does PDF file in the Java Cache on the Client. Or is there any utility to remove selected objects from the Java Cache.
    Does anybody have a Idea how to avoid such a behaviour?
    Fatih

    Hi Craig,
    with the help of Oracle Support, we found the reason and also a workaround for this issue.
    The real cause:
    By default the java applet parameter DefaultUseCaches is true an all files downloaded within an applet is going throug the Java Client Cache.
    WEBUTIL does not touch this parameter, so it keeps staying default (true).
    Solution/workaround:
    With the methode setDefaultUseCaches it possible to disable/enable the default Cache setting.
    So it's possible to disable the cache with a small Java Bean running in Forms, which disable the Cache before WEBUTIL_FILE_TRANSFER and enable it after the successfull download.
    here is an extract of the bean code:
    URL u = new URL( "http:" );
    URLConnection uc = u.openConnection();
    uc.setDefaultUseCaches(false);
    thank you for your time!
    regards,
    Fatih

  • How can I get a count of objects in the near cache? (Extend client)

    Hi,
    I'm trying to figure out how to get the count of objects in my near cache (from c++ client). Knowing the size of the near cache is a key factor when optimizing configurations for performance.
    However if I call size() on the cache handle I get the count of objects in the cache (ie the cluster). How can I get a count of objects in the near cache?
    Thanks
    Rich Carless

    H Rich,
    It may not be ideal, but I think you may be able to infer the size by using the HeapAnalyzer (http://download.oracle.com/docs/cd/E15357_01/coh.360/e15728/classcoherence_1_1lang_1_1_heap_analyzer.html) facility, specifically the "class" based HeapAnalyzer. Its Snapshot representation http://download.oracle.com/docs/cd/E15357_01/coh.360/e15728/classcoherence_1_1lang_1_1_class_based_heap_analyzer_1_1_snapshot.html provides a mapping between class name and ClassStats (http://download.oracle.com/docs/cd/E15357_01/coh.360/e15728/classcoherence_1_1lang_1_1_class_based_heap_analyzer_1_1_class_stats.html) which provides information on how many instances of a given class type are in memory. Note the reported counts are process wide but if your key or value type are distinct you may be able to infer your answer. I realize this is rather complex, my only other suggestion would be to just make some guesses on size and see how they effect performance.
    Mark
    Oracle Coherence

  • Putting a object on the coherence cache

    Hi All,
    Is there a better way of doing the following:
    In a multi-threaded region of code I perform the following sequence of steps:
    1. Use a filter to check if object foo already exists on the cache.
    2. if the result set of the filter is null, I perform a lock Cache.lock(foo.getUniqueID);
    3. I put the object foo on the cache Cache.put(foo);
    Basically I am trying to avoid another thread from overwriting the existing cache object.
    Is there a better way to achieve this ?
    regards,
    Ankit

    Hi Ankit,
    You can use a ConditionalPut EntryProcessor http://docs.oracle.com/cd/E24290_01/coh.371/e22843/toc.htm
    Filter filter = new NotFilter(PresentFilter.INSTANCE);
    cache.invoke(foo.getUniqueID(), new ConditionalPut(filter, foo));An EntryProcessor will take out an implicit lock on the key so no other EntryProcessor can execute on the same key at the same time. The ConditionalPut will apply the specified Filter to the entry (in this case to check that it is not present, and if this evaluates to true then will set the specified value.
    JK

  • Caching objects in the data cache as a result of an extent.

    Patrick -
    I wanted to post this since it's related to a question I posted about extents and the data cache on
    11/8.
    I discovered that the com.solarmetric.kodo.DefaultFetchBatchSize setting affects how many objects
    get put into the data cache as a result of running an extent (in 2.3.2). If I have:
    com.solarmetric.kodo.DefaultFetchBatchSize=20
    then as soon as I execute the second line below:
    Iterator anIterator = results.iterator();
    Object anObject = anIterator.next();
    I see 20 objects in my data cache. In a prior reply you indicated that you were going to check this
    behavior in 2.4 so I wanted to send you this additional information. This behavior isn't a problem
    for me.
    Les

    Les,
    This is expected behavior -- the DefaultBatchFetchSize instructs Kodo to
    retrieve objects from the scrollable ResultSet in groups of 20. So,
    getting the first item from the iterator will cause a page of 20 objects
    to be pulled from the result set.
    -Patrick
    Les Selecky wrote:
    Patrick -
    I wanted to post this since it's related to a question I posted about
    extents and the data cache on
    11/8.
    I discovered that the com.solarmetric.kodo.DefaultFetchBatchSize
    setting affects how many objects
    get put into the data cache as a result of running an extent (in
    2.3.2). If I have:
    com.solarmetric.kodo.DefaultFetchBatchSize=20
    then as soon as I execute the second line below:
    Iterator anIterator = results.iterator();
    Object anObject = anIterator.next();
    I see 20 objects in my data cache. In a prior reply you indicated that
    you were going to check this
    behavior in 2.4 so I wanted to send you this additional information.
    This behavior isn't a problem
    for me.
    Les
    Patrick Linskey [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Why is some of the objects in the object library are greyed out?

    I haven't seen this before and it's annoying, because it's the objects I need such as text, text object etc!

    Hi,
    Designer deactivates all objects in the palette that are not supported in a static form.
    This happens when you create a form by importing an static PDF file.

  • SSMS is not listing table and views objects though the objects are listed when I execute TSql string "SELECT * FROM sys.Tables"

    I have a db, call it xyz.mdb
    It suddenly is that SSMS is not listing the table objects nor the Views.  SELECT * FROM sys.Tables and SELECT * FROM sys.Views work very fine.  But when I click on the tables node, on Objects Explorer, Only the Systems Tables and File Tables folders
    show. 
    Other DBs on same SQL instance do not show same problem.  They are all working very fine.
    I have backed up and restored this db on other computers and the behaviour is the same.  Incidentally right-clicking the db and clicking Properties throws up this error message.
    -------------------------------------------------------------------------Error!
    Cannot show requested dialog.
    Property Size is not available for Database '[Pliny E DB - NOA 2014]'. This property may not exist for this object, or may not be retrievable due to insufficient access rights.  (Microsoft.SqlServer.Smo)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.3000.0+((SQL11_PCU_Main).121019-1325+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.PropertyCannotBeRetrievedExceptionText&EvtID=Size&LinkId=20476
    --------------------------------------------------------------------------------End>
    When I try to Refrresh the Tables node on Object Explorer, I get this other:
    ------------------------------Error!
    SQL Server detected a logical consistency-based I/O error: incorrect checksum (expected: 0x9090d9b7; actual: 0x909001b4). It occurred during a read of page (1:1173) in database ID 21 at offset 0x0000000092a000 in file 'c:\Databases\Clients\NOA\Pliny E DB -
    NOA 2014.mdf'.  Additional messages in the SQL Server error log or system event log may provide more detail. This is a severe error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check
    (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online. (Microsoft SQL Server, Error: 824)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=824&LinkId=20476
    ------------------------------End>
    The Help link of course is not valid any more.
    Many thanks
    Vie
    @Abuja
    Vie

    Your database is corrupted and you need to run.
    DBCC CHECKDB
    You already have a backup so do it...
    This link will provide you with more information:
    http://msdn.microsoft.com/en-us/library/ms176064.aspx

  • Cannot remove the access control entry object on the object because the ACE isn't present

    Hello,
    I am very new to using Powershell and Exchange Management Shell, and have no prior experience using either of these tools. However, the software I am installing requires me to use the EMS tool in order to set certain permissions for a user in Exchange, which
    will be like the admin account. 
    The command I am attempting to run follows as:
    Get-ExchangeServer | Remove-ADPermission -User $newusername -Deny -ExtendedRights Receive-As -Confirm:$False 
    This throws me an error saying:
    cannot remove the access control entry on the object because the ACE isn't present. I've done some research, and have found that this error is quite common, but the solutions do not apply to what I am specifically trying to accomplish. I am simply trying
    to remove the Receive-As permission for the admin user that I just created.
    Once again, I am very new to Exchange and Powershell, but if there is any advice anyone has, it would greatly appreciated.

    I ran this command, and a very long list was displayed, it looks like everything is there.
    The weird thing is that I was able to run a previous command which granted Receive-As access to the user I am creating: 
    Get-ExchangeServer | Add-ADPermission -User $newusername -accessrights GenericRead, GenericWrite -extendedrights Send-As, Receive-As, ms-Exch-Store-Admin -Confirm:$False 
    The description for the commands to run read to 'grant permissions and to revoke denies, if present'. I'm not sure what this means, but the second part of this pertains to the second command that I am having trouble with:
    Get-ExchangeServer | Remove-ADPermission -User $newusername -Deny -ExtendedRights Receive-As -Confirm:$False

  • SQL Server Agent; no permission to process the object

    Hi All,
    I've been having trouble getting my SQL Server Agent Jobs working. It's throwing the following error: Executed as user: NT Service\SQLSERVERAGENT. Microsoft.AnalysisServices.Xmla.XmlaException: Either the 'NT Service\SQLSERVERAGENT' user does not hav eperimission
    to process the '<datamodel-name>' object, or the object does not exist.
    I've added the NT Service\SQLSERVERAGENT account to the required local policies (as described here
    http://technet.microsoft.com/en-us/library/ms178142.aspx):
    Log on as a service (SeServiceLogonRight)
    Replace a process-level token (SeAssignPrimaryTokenPrivilege)
    Bypass traverse checking (SeChangeNotifyPrivilege)
    Adjust memory quotas for a process (SeIncreaseQuotaPrivilege)
    The job is a SSAS command and runs as the SQL Server Agent Service Account on the localhost. The command is:
    <Process xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">
      <Type>ProcessFull</Type>
      <Object>
        <DatabaseID><datamodel-name></DatabaseID>
      </Object>
    </Process>
    Any clues what it could be? The command runs just find on another SSAS server.
    Thanks,
    Carter

    have you given access to this service account inside SSAS  for process database?
    http://www.mssqltips.com/sqlservertip/2776/configuring-permissions-for-sql-server-analysis-services/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • "Hacking" the Object streams...

    Hello everyone,
    Here's what I'm trying to do:
    I have to transmit Object graphs over a message oriented networking framework at a rate of about 100 messages per second. Since i can't maintain constant data streams between the peers the first thing that comes in mind is to create an ObjectOutputStream to "fill in" each message and on the far side an ObjectInputStream to read the contents of each message. This aproach however seems to be too coastly for the goals I have to meet. So the first questin I have is:
    How coastly realy it is to create 200 Object streams per second?
    And the second question I got is:
    Is there a way to safely reuse only a single pair of Object streams?
    I tried to run the object streams over my custom implenentations of OutputStream and InputStream that allow me to write the object, flush the object stream, obtain the byte[] block that was produced, fill it in a message and transmit it. On the far side I respectively "slip" this byte[] block "beneath" the ObjectInputStream and reconstruct the Object. This aproach worked for simple data structures and yelded the desired high throughput. With complex structured however this yelds horrific StreamCorruptedExceptions :(

    I think creating 200 streams per second can't be fast. But a stream can send as much data as you want to push thru it (underlying connection mechanism restrictions apply... e.g. TCP over the internet is not as fast as TCP over a LAN or within the same PC).
    If you're large objects are not containing all serializable contents, that could cause problems, I think. Sticking a non-serializable object inside a serializable one doesn't make the non-serializable one serializable.

  • Help on PO13 ---- "SAP Organizational Object"  in the table control.

    Hi All,
    Can some one tell me details on or where to read from ..... PO13 -> "SAP Organizational Object"  in the table control.
    For eg if you go to PO13 -
    > "Relationships"  in the table control you get all the hierarchy details of an employee (eg: reports to, belongs to, holder ...etc.).
    Similarly what would you get when u go to PO13 -
    > "SAP Organizational Object" -
    > Overview  in the table control. Is it something to do with product hierarchy ..... am not very sure. I am working on a sandbox on a trial workflow for learning purpose and I do not have it configured so that I can look for some samples.
    I understand I am not very clear about my question, but still I hope if someone can answer.
    Thanks,
    Anu.

    An object type is a generic description of an object.
    The object type definition determines the object type by specifying its various components.
    An object type is defined by its
    Basic data, such as name, created by...
    Key fields, which give each object a unique ID
    Attributes as the characteristics of an object
    Methods with parameters and exceptions as activities that can be performed for an object
    Events, which describe any changes that occur
    Implementation in the program code
    After assigning Object Type, you should click on Assign Key.. and assign respectuve Object ID.
    This will create link between Object in HR-OM with Object of other modules like Sales, Vendor, Purchase etc.
    Note sure, how this is used in Workflow... i never worked on workflows.
    Regards
    ...SAdhu

  • DropTarget check against all objects on the stage

    Hey all,
    Not sure the best way to do this.  I have a class we will call DropActivity, here is the code
    package com.activitycontrol
              import com.activitycontrol.DropCheck;
              public class DropActivity
                   // Constants:
                   // Public Properties:
                   // Private Properties:
                   private var _selectedClip:Object;
                        // Initialization:
                        public function DropActivity(/*selectedClip:Object*/)
                        // Public Methods:
                        public function set selectedClip(selectedClip:Object):void
                                  _selectedClip = selectedClip;
                        public function stopDraggingMe():void
                                       var dropCheck:DropCheck = new DropCheck();
                                       //dropCheck.checkAgainst = dropTarget.name; ///***********
                                       if (dropCheck.canBeDropped == true)
                                            _selectedClip.stopDrag();     
                        // Protected Methods:
    when the stopDraggingMe() method is called from another object (code shown below) I need to see all the objects on the stage to see what objects on the stage my currently selected movie clip is over and assign it to the dropCheck.checkAgainst method (that will be checked against an array to see if it can in fact be dropped, if so set the canBeDropped value to true and therefor run the .stopDrag() ).  I have read using root is not a good coding practice in AS 3.
    call to the stopDraggingme() mehod.
    private function setDown(event:MouseEvent):void
                             var droppedItem:DropActivity = new DropActivity();
                             droppedItem.selectedClip = this;
                             droppedItem.stopDraggingMe();

    No, I think I can use drop target, I just need to use it from the DropActivity class and not a document class. I just don't know how to use it from a non-document class.
    "and you need to loop through all displayobjects to see which have a positive hitTest with your dropped object, correct?"
    I am trying to say..... ok, what movie clip is currently under the one I have selected,  the drop activity class knows what object I have selcted as it is in the selectedClip variable.  so I need to find out what clip is under it ......... the light just came on!
    answer duh......dropCheck.checkAgainst = _selectedClip.dropTarget.parent.name;
    thanks a bunch kglad you have helped me out once again, you are the man. I might just have to buy you a beer one of these days.

  • Please tell me the way to access the object...........?

    when we are decleared a class variable,there should be an object in the memory.this object is the object of the java.obj.Class class.............
    my query is ..
    how to acess that object ?
    e.g.
    public class Basic
    public class Acsess{
    Basic b;//now please tell how access the object of class Basic.Class?......
    thanks and regurds

    I believe that the following example will help. You should also read this tutorial page:
    [Understanding Instance and Class Members|http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html]
    class A
        static String fie = "this is fie";
        String foo = "this is foo";
    public class B
        public static void main(String[] args)
            System.out.println(A.fie);
            A instance = new A();
            System.out.println(instance.fie); // Not recommended; does not
                                              // make it clear that fie is
                                              // a class (static) variable
            System.out.println(instance.foo);
    }

  • Transform handles are moving the object and not scaling.

    I've been running into trouble with the transform handles on objects moving the object instead of scaling/stretching the object. It seems to happen on the bottom and right sides vs the top and left sides. When I have the mouse over the handle it shows the scaling icon, but when I press the mouse it turns into the black selection arrow. Is anyone else experiencing this and know how to fix it?

    kjredin,
    I am afraid you have come across the Live Rectangle bug which is limited to the MAC versions starting with 10.7 and 10.8, but not 10.9 (Mavericks) or 10.10 (Yosemite). Hopefully, the bug will be fixed soon.
    So a switch to Mavericks or Yosemite with a reinstallation might be the way to solve it here and now.
    To get round it in each case, it is possible to Expand the Live Rectangles to get normal old fashioned rectangles, or to Pathfinder>Unite, or to use the Scale Tool or the Free Transform Tool.
    A more permanent way round that is to create normal old fashioned rectangles, after running the free script created by Pawel, see this thread with download link:
    https://forums.adobe.com/thread/1587587

  • Looking for "The Objective-C Programming Language"

    Greetings All, I am teaching myself write iOS apps and Objective-C and have several references.  Developer.apple.com's Learning Object-C: A Primer references The Objective-C Programming Language, but there is no link or ISBN or author and interent search is useless.  I found a link mentioned in a Nov 2012 discussion, but the link is now bad.
    Can anyone help?
    Thanks in advance,
    SP

    It's in Xcode's documentation view, under "OS X 10.7 Core Library > Languages & Utilities > Objective-C > The Objective-C Programming Language"
    Actually, it seems to be in every core library for OS X and iOS, except for the OS X 10.8 doc set and the iOS 6.1 doc set...not sure if that means it's deprecated, or if it's just an oversight.

Maybe you are looking for