Memory Leak in Publish-Subscribe Notification

I am using publish-subscribe notification for async-notification on LINUX( ORACLE 8.1.7). Before doing it, I read a document(OCI Programmer!/s Guide) about publish-subscribe notification(chap.9).
I created Queue(AQ) in database and registered callback function using 'OCISubscriptionRegister()'.
All operations are done succesfully , but when OCISubscriptionRegister() is called, memory leak seems to occur. I check up the memory leak using LINUX system call( 'top' and 'vmstat' ).
Does anyone have any idea or experience of this problem?

<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Lee Sung-won ([email protected]):
Thanks for your reply..
I have something to ask you. where can I get a document listing the bug?<HR></BLOCKQUOTE>
null

Similar Messages

  • The Publish-Subscribe Notification latency in OCI is 5 seconds

    I have an OCI application where I register a callback to receive publish-subscribe notifications from an Oracle queue.
    The problem that I have is that I am receiving messages every 5 seconds intervals (the callback is called every 5 seconds if there are messages in the queue).
    It looks like that there is a process that is monitoring the database queue every 5 seconds. Is there a way to change that behavior?.
    I am getting the same behavior in Windows and Linux systems.
    This is the PL/SQL code that I am executing to create the database queue:
    DECLARE
    subscriber sys.aq$_agent;
    BEGIN
    DBMS_AQADM.CREATE_QUEUE_TABLE(
    QUEUE_TABLE=>'TestUser."TestTable_msg_table"',
    MULTIPLE_CONSUMERS => TRUE,
    QUEUE_PAYLOAD_TYPE =>'RAW');
    DBMS_AQADM.CREATE_QUEUE(
    QUEUE_NAME=>'TestUser."TestTable_queue"',
    QUEUE_TABLE=>'TestUser."TestTable_msg_table"');
    DBMS_AQADM.START_QUEUE('TestUser."TestTable_queue"');
    subscriber := sys.aq$_agent('AGENT', null, null);
    DBMS_AQADM.ADD_SUBSCRIBER(
    QUEUE_NAME=> 'TestUser."TestTable_queue"',
    SUBSCRIBER => subscriber,
    DELIVERY_MODE => DBMS_AQ.BUFFERED);
    END;
    CREATE OR REPLACE TRIGGER TestUser."TestTable_changes"
    AFTER DELETE OR INSERT OR UPDATE ON TestUser."TestTable"
    FOR EACH ROW
    DECLARE
    enq_ct dbms_aq.enqueue_options_t;
    msg_prop dbms_aq.message_properties_t;
    enq_msgid raw(16);
    userdata raw(100);
    BEGIN
    enq_ct.visibility := DBMS_AQ.IMMEDIATE;
    enq_ct.delivery_mode := DBMS_AQ.BUFFERED;
    msg_prop.delay := DBMS_AQ.NO_DELAY;
    DBMS_AQ.ENQUEUE('TestUser."TestTable_queue"',enq_ct, msg_prop,userdata,enq_msgid);
    END;
    This is the OCI code that I am executing to register for changes into the queue:
    /* Allocate subscription */
    OCIHandleAlloc((dvoid *)hEnv,(dvoid **)&hSub,
              (ub4) OCI_HTYPE_SUBSCRIPTION,
              (size_t) 0, (dvoid **) 0);
    OCIAttrSet((dvoid *)hSub, (ub4) OCI_HTYPE_SUBSCRIPTION,
    (dvoid *) subName, (ub4) strlen(subName),
    (ub4) OCI_ATTR_SUBSCR_NAME, hError);
    /* Subscription callback */
    OCIAttrSet((dvoid *)hSub,(ub4)OCI_HTYPE_SUBSCRIPTION,
    (dvoid *) onTableChange, (ub4) 0,
    (ub4) OCI_ATTR_SUBSCR_CALLBACK, hError);
    /* Set subscription context */
    OCIAttrSet((dvoid *) tblInfo, (ub4) OCI_HTYPE_SUBSCRIPTION,
    (dvoid *) 0, (ub4) 0,
    (ub4) OCI_ATTR_SUBSCR_CTX, hError);
    /* Set subscription namespace */
    OCIAttrSet((dvoid *) hSub, (ub4) OCI_HTYPE_SUBSCRIPTION,
    (dvoid *) &subNamespace, (ub4) 0,
    (ub4) OCI_ATTR_SUBSCR_NAMESPACE, hError);
    /* Begining Registration for subscription */
    OCISubscriptionRegister(hSvc,&hSub,1,hError,OCI_DEFAULT);
    Thanks

    This has come up before. No definitive solution but a purge of the queue is worth a try:
    see=> Re: Dequeing happens only every 5 Seconds

  • Memory leak in LR.

    I'm getting what appears to be a memory leak in LR. Is anyone else experiencing this ramp of memory usage as viewed in Task Manager. I have 32GB of DDR3 installed and LR takes it all and want's more. The ramp peaks with all of physical memory allocated to LR (~28GB) and a total of ~47GB allocated to the app. Once it hangs out in slowmageddon for awhile it drops back down to around 13GB and restarts the ramp (~ 30seconds or so) to full allocation again.
    Does anyone have a clue what could be wrong with my installation?
    Thanks in advance for your help.

    My PC is running Windows 7 Professional with Service Pack 1, 64-bit
    My Lightroom info is below from the help menu
    Thanks for your help...
    Lightroom version: 5.7.1 License type: PerpetualOperating system: Windows 7 Business EditionVersion: 6.1 Application architecture: x64System architecture: x64Logical processor count: 8Processor speed: 3.5 GHzBuilt-in memory: 32728.0 MBReal memory available to Lightroom: 32728.0 MBReal memory used by Lightroom: 10881.6 MB (33.2%)Virtual memory used by Lightroom: 18161.4 MBMemory cache size: 0.0 MBMaximum thread count used by Camera Raw: 4System DPI setting: 96 DPIDesktop composition enabled: YesDisplays: 1) 1920x1200, 2) 1920x1200, 3) 1920x1200
    Application folder: E:\Program Files\Adobe\Adobe Photoshop Lightroom 5.7.1Library Path: H:\My Pictures2\Lightroom\Lightroom 5 Catalog.lrcatSettings Folder: C:\Users\Tim\AppData\Roaming\Adobe\Lightroom
    Installed Plugins: 1) Behance2) Canon Tether Plugin3) Export to Photomatix Pro4) Facebook5) Flickr6) JPEG Optimizer7) Leica Tether Plugin8) Merge to 32-bit HDR9) Nikon Tether Plugin10) Perfect Effects 811) Photo Upload12) SkyDrive Upload
    Config.lua flags: None
    Adapter #1: Vendor : 1002 D
          From: F. McLion <[email protected]>
    To: Timothy Parker <[email protected]>
    Sent: Thursday, February 5, 2015 8:14 AM
    Subject:  Memory leak in LR.
    Memory leak in LR.
    created by F. McLion in Photoshop Lightroom - View the full discussionVersion of OS?Version of LR?Print of the diagnostics in LR's Help menu (remove the serial!) If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7165586#7165586 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7165586#7165586 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following"  Start a new discussion in Photoshop Lightroom by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624.

  • Memory leak with callback function

    Hi,
    I am fairly new to LabWindows and the ninetv library, i have mostly been working with LabVIEW.
    I am trying to create a basic (no GUI) c++ client that sets up subscriptions to several network variables publishing DAQ data from a PXI.
    The data for each variable is sent in a cluster and contains various datatypes along with a large int16 2D array for the data acquired(average array size is 100k in total, and the average time between data sent is 10ms). I have on average 10 of these DAQ variables.
    I am passing the same callback function as an arguement to all of these subscriptions(CNVCreateSubcription).
    It reads all the correct data, but i have one problem which is that i am experiencing a memory leak in the callback function that i pass to the CNVCreateSubscription.
    I have reduced the code one by one line and found the function that actually causes the memory leak, which is a CNVGetStructFields(). At this point in the program the data has still not been passed to the clients variables.
    This is a simplified version of the callback function, where i just unpack the cluster and get the data (only showing from one field in the cluster in the example, also not showing the decleration).
    The function is passed into to the subscribe function, like so:
    static void CNVCALLBACK SubscriberCallback(void * handle, CNVData data, void * callbackData);
    CNVCreateSubscriber (url.c_str(), SubscriberCallback, NULL, 0, CNVWaitForever, 0 , &subscriber);
    static void CNVCALLBACK SubscriberCallback(void * handle, CNVData data, void * callbackData)
    int16_t daqValue[100000];
    long unsigned int nDims;
    long unsigned int daqDims[2];
    CNVData fields[1];
    CNVDataType type;
    unsigned short int numFields;
    CNVGetDataType(data, &type, &nDims);
    CNVGetNumberOfStructFields (data, &numFields);
    CNVGetStructFields (data, fields, numFields); // <-------HERE IS THE PROBLEM, i can comment out the code after this point and it still causes a memory leak.
    CNVGetDataType(fields[0], &type, &nDims);
    CNVGetArrayDataDimensions(fields[0], nDims, acqDims);
    CNVGetArrayDataValue(fields[0], type, daqValue, daqDims[0]*daqDims[1]);
    CNVDisposeData(data);
    At the average settings i use all my systems memory (4GB) within one hour. 
    My question is, have any else experienced this and what could the problem/solution to this be?
    Thanks.
    Solved!
    Go to Solution.

    Of course.....if it is something i hate more than mistakes, it is obvious mistakes.
    Thank you for pointing it out, now everything works

  • Need to "publish/subscribe" my Contacts info like we could in Addressbook. Any ideas?

    Being a LONG TIME Mac User (yes, I owned a Lisa in the early 80’s and it still runs!)  I have lived thru the transition from OS 6 and 7, then 8, 9 and finally the upgrade to OSX and thru its incarnations up to my current Maverick (aka OS 10.9.4).  I am no stranger to changes on the Mac OS.  But the new Contacts file within iCloud has me lost. For many years my spouse and I would cross share portions of our personal AddressBook using that softwares publish/subscribe function. It worked great! I could have a list of his relatives/names/phones/addresses in case I needed them - and he had the same for me. With a glance he could see that my sisters middle name was Louise and she hated it. Useful info for when she was being icy to him on a phone call. <grin> We had the shared groups identified as coming from my AddressBook or his, and we could share subgroups or the entire thing as we might choose. 
    When we went to iCloud and now Maverick, there is no longer a way to share the contact info short of buying the Apple Server software and setting up our own server in house. While I might be able to justify doing so, it is a huge hassle for a very small gain in our case. So that is a last-resort solution, so far.
    I would again like to be able to share portions (groups/or sub-groups) of my contact database files with specific individuals, using something like a publish/subscribe feature that would require both parties to agree to the sharing and then once that was done, it should implement automatically and update every time an items is changed, added, deleted on the owners main copy of Contacts.  Ideally this would work thru iCloud and its “push update” function.  But just to have it working is the goal here. I really do not care HOW it works.
    Ive searched, even called a buddy who works the Genius Bar at my local Apple Store. So far, no one seems to have any suggestion other than the aforementioned Maverick Server idea.  Frankly with three computers, two printers, a few iPads and iPhones, and a couple of Apple TVs in the house, I am hard pressed to justify the time and energy running a server would require.  There has to be a better way to do this. If friends can push their Contact Info to their Android Phones, I should be able to share my Contact files with my spouse!  Thanks for your thoughts/suggestions/and hopefully for a solution.

    Is the disk cache and the memory cache enabled?
    You can check these prefs on the about:config page.
    * http://kb.mozillazine.org/browser.cache.disk.enable
    * http://kb.mozillazine.org/browser.cache.memory.enable
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />
    Your More system details list shows two outdated Flash plugins that you should remove and update to Flash 10.1 r102 or at least remove 10.0 r45 and wait until your distribution offers a 10.1 r102 update.
    # Shockwave Flash 10.0 r45
    # Shockwave Flash 10.1 r85
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/

  • Memory leak within FOProcessor class

    Hi all,
    I'm trying to use the XML Publisher API (5.6.2 and 5.6.3) to generate PDF documents from XSL templates and XML data in a J2EE environment (Jboss 4.0.5) with Struts but a memory leak occurs.
    It seems not to be a multithreading issue because the leak is there even if the PDF documents are generated one by one.
    I made many tests to isolate the leak and I have simplified my code as much as possible: it seems to happen within the FOProcessor class.
    One of the tests generates 4,500 PDF documents (one at a time) from an XML file (3 KB) and an XSL file (74 KB with blanks). Nothing else is done with the Jboss server during this test. The XSL file was created before the test from a RTF file with XML Publisher. The memory leak is around 70 KB for each PDF document (around 300 MB for the whole test).
    As you can see below from the heap histogram (taken at end of test after a full garbage collection) it seems that the XSL and XML elements/attributes are not released (and thus never garbage collected).
    Did I miss something or is there an actual problem with the XML/XSL parsing within the XML Publisher API?
    Thanks for your help.

    Object Histogram:
    Size    Count     Class description
    131376968 2353450 java.lang.Object[]
    60389464 937300  char[]
    48260304 335141  oracle.xml.parser.v2.XSLResultElement
    35690000 2230625 oracle.xml.util.FastVector
    24127104 1005296 java.lang.String
    16539120 413478  oracle.xml.parser.v2.XSLNode$AttrValueTmpl
    14757064 128058  int[]
    13348768 417149  java.lang.ref.Finalizer
    12701776 102220  * ConstMethodKlass
    12544808 23433   byte[]
    12204080 108965  oracle.xml.parser.v2.XSLText
    8344600 86584   java.util.Hashtable$Entry[]
    7363768 102220  * MethodKlass
    5592784 138700  * SymbolKlass
    5362256 335141  oracle.xml.parser.v2.XSLAttributeSet[]
    5267336 8135    * ConstantPoolKlass
    5234016 163563  java.util.TreeMap$Entry
    5121744 213406  java.util.Hashtable$Entry
    4900480 61256   oracle.xml.parser.v2.XPathStep
    4087120 51089   java.lang.reflect.Method
    3823216 40276   java.util.HashMap$Entry[]
    3524696 8135    * InstanceKlassKlass
    3378000 84450   java.util.Hashtable
    3064872 127703  java.util.HashMap$Entry
    2971904 6880    * ConstantPoolCacheKlass
    2968560 26505   oracle.xml.parser.v2.XSLValueOf
    2770656 24738   oracle.xml.parser.v2.XSLVariable
    2167520 27094   oracle.xml.parser.v2.XPathFunctionCall
    1880088 33573   oracle.xml.parser.v2.PathExpr
    1726360 61482   java.lang.String[]
    1573720 39343   java.util.HashMap
    1476576 30762   oracle.xml.parser.v2.XSLExprValue
    1460840 36521   java.util.TreeMap
    1319360 23560   oracle.xml.parser.v2.XPathConstantExpr
    1054976 16484   org.jboss.mx.server.InvocationContext
    1001264 3546    * MethodDataKlass
    887424  11049   short[]
    835680  8705    java.lang.Class
    830208  25944   oracle.xml.util.NSNameImpl
    705816  29409   java.util.ArrayList
    684152  4501    org.jboss.web.tomcat.tc5.session.SessionBasedClusteredSession
    670288  14071   java.lang.Object[]
    640832  10013   oracle.xml.parser.v2.XPathVarReference
    561056  35066   javax.management.modelmbean.DescriptorSupport
    556272  23178   EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap$Entry
    552984  30451   java.lang.Class[]
    494760  2945    oracle.xml.parser.v2.XSLTemplate
    480792  20033   antlr.ANTLRHashString
    442576  27661   java.lang.Integer
    432096  4501    org.jboss.web.tomcat.statistics.ReplicationStatistics$TimeStatistic
    429040  10726   org.hibernate.hql.ast.tree.Node
    369880  9247    javax.management.modelmbean.ModelMBeanOperationInfo
    312384  19524   java.util.TreeMap$3
    305368  5453    java.net.URL
    287392  8981    org.jboss.mx.interceptor.ReflectedDispatcher
    259264  338     EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap$Entry[]
    252280  4505    org.jboss.cache.lock.ReadWriteLockWithUpgrade
    238600  5965    org.jboss.mx.interceptor.PersistenceInterceptor
    238600  5965    org.jboss.mx.interceptor.AttributeDispatcher
    236616  9859    org.jboss.mx.server.AbstractMBeanInvoker$OperationKey
    219776  3434    java.lang.reflect.Constructor
    206880  6465    javax.management.modelmbean.ModelMBeanAttributeInfo
    193168  2259    java.lang.reflect.Method[]
    173184  5412    java.lang.ref.SoftReference
    164920  589     oracle.xml.parser.v2.XSLStylesheet
    164464  541     * ObjArrayKlassKlass
    152832  6368    org.dom4j.tree.DefaultAttribute
    149472  2076    java.lang.reflect.Field
    144160  4505    org.jboss.cache.Node
    143160  5965    org.jboss.mx.interceptor.ModelMBeanAttributeInterceptor
    140600  3515    org.apache.xerces.dom.DeferredTextImpl
    140224  2740    javax.management.modelmbean.ModelMBeanAttributeInfo[]
    139056  7658    boolean[]
    134664  3359    java.lang.String[][]
    131936  1178    oracle.xml.parser.v2.XSLCondition
    131936  1178    oracle.xml.parser.v2.XSLForEach
    129072  2668    javax.management.modelmbean.ModelMBeanOperationInfo[]
    128952  5373    EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap$Entry
    124776  1733    org.hibernate.hql.ast.tree.IdentNode
    115200  1800    javax.management.modelmbean.ModelMBeanInfoSupport
    113088  2356    oracle.xml.parser.v2.AdditiveExpr
    109416  4559    java.beans.PropertyChangeSupport
    108960  1135    java.io.ObjectStreamClass
    108120  4505    org.jboss.cache.lock.IdentityLock
    105864  345     long[]
    98752   3086    java.io.ObjectStreamClass$WeakClassKey
    97968   4082    java.util.Vector
    96672   2014    java.util.Properties
    94240   589     oracle.xml.parser.v2.XSLOutput
    90072   3753    javax.management.ObjectName$Property
    87432   3643    javax.management.MBeanParameterInfo
    82368   858     org.hibernate.hql.ast.tree.DotNode
    81248   5078    java.lang.Long
    78656   1229    org.hibernate.mapping.Column
    77664   4854    java.util.Collections$SynchronizedSet
    77448   3227    java.util.LinkedList$Entry
    73824   769     org.jboss.mx.modelmbean.XMBean
    73536   4596    java.util.Hashtable$KeySet
    72144   4509    EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArraySet
    72144   4509    EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArrayList
    72144   4509    org.jboss.cache.Fqn
    72080   4505    org.jboss.cache.lock.ReadWriteLockWithUpgrade$WriterLock
    72080   4505    org.jboss.cache.lock.LockStrategyRepeatableRead
    72080   4505    org.jboss.cache.lock.ReadWriteLockWithUpgrade$ReaderLock
    72080   4505    org.jboss.cache.lock.LockMap
    72016   4501    org.apache.catalina.session.StandardSessionFacade
    71776   4486    java.io.FileDescriptor
    70680   589     oracle.xml.parser.v2.XSLCallTemplate
    70680   589     oracle.xml.parser.v2.XSLApplyTemplates
    70224   154     org.hibernate.persister.entity.SingleTableEntityPersister
    68296   2774    javax.management.ObjectName$Property[]
    68160   1065    org.apache.xerces.dom.DeferredElementNSImpl
    67760   770     org.hibernate.loader.entity.EntityLoader
    66992   19      EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap$Entry[]
    65968   1178    oracle.xml.parser.v2.XPathFilterExpr
    65968   589     oracle.xml.parser.v2.XMLUTF8Reader
    64432   4027    java.util.HashSet
    63648   1326    oracle.xml.parser.v2.XMLNode[]
    63440   1586    org.hibernate.loader.DefaultEntityAliases
    61256   589     oracle.xml.parser.v2.XSLNode
    61256   589     oracle.xml.parser.v2.XMLReader
    60816   2534    org.apache.xerces.xni.QName
    57360   478     org.hibernate.hql.ast.tree.FromElement
    56976   1187    org.hibernate.mapping.Property
    56544   1178    oracle.xml.parser.v2.XSLNodeSetExpr
    56544   1178    oracle.xml.parser.v2.MultiplicativeExpr
    56544   1178    oracle.xml.parser.v2.EqualExpr
    54384   618     oracle.xml.parser.v2.XMLError
    49392   2783    javax.management.MBeanParameterInfo[]
    47648   1489    java.util.LinkedHashMap$Entry
    47120   589     oracle.xml.parser.v2.XMLByteReader[]
    ...

  • Problem Report: Severe memory leak in Flash Player 9.0

    Summary
    Flash player 9.0 is prone to a severe memory leak when
    playing SWF files produced by Captivate 1 containing full-motion
    recordings.
    Versions affected
    The problem reproduces with Flash player 9.0 (Flash9.ocx,
    Version 9.0.16.0) hosted in either Internet Explorer 6.0 or Mozilla
    Firefox 1.5 on a Windows XP SP2 system.
    The problem does not reproduce with Flash player 8.0
    (Flash8.ocx, Version 8.0.22.0) in the same environment.
    Description
    After a few minutes playing a SWF file produced by Captivate
    1 containing a full-motion recording recorded with Captivate 1, the
    host browser ends up using more than a gigabyte of memory, and the
    playback of the movie slows down to a halt, together with
    responsiveness of the whole system.
    Impact
    Our organization develops E-learning content with Captivate 1
    for various customers, mostly Fortune 100 companies.
    This bug severely limits our ability to deliver content to
    our customers.
    Steps to reproduce
    1. Using Captivate 1.01.1418, create a “blank
    movie” with default settings.
    2. Use the “Record” button and begin recording a
    full-motion movie for about 2-4 minutes. For the purposes of this
    bug, it is enough to record a user typing random text in a Notepad
    window resized to fit in the default 800x600 window.
    3. After recording the full-motion movie, publish the
    Captivate movie as a “Flash (SWF)” movie, using default
    settings (making sure that the “export HTML” checkbox
    is selected).
    4. Open the published movie’s HTML file with a host
    browser, making sure that the browser is using the Flash 9.0
    player.
    5. While the movie is playing, watch the memory usage of the
    browser process using Windows Task Manager, and you will see that
    the values of the “Mem Usage” and “VM Size”
    counters keep increasing until the system becomes unusable.

    Also see:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=44&catid=184&threadid =1249396&enterthread=y
    Flash is generating around 300 page faults per second per
    flash animation
    Performance
    issues: page faulting
    Flash is also generating around 300 page faults per second.
    This can be observed by following the instructions in the link
    above for displaying page faults in the system task manager.

  • Easy to produce - Memory Leak in JVM Using thread

    I was just debugging the problem with our server and got this error (not from the original code, I reproduced it with small code)
    at java.lang.Thread.run(Unknown Source)
    java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Unknown Source)
    at SomeObject.resursiveThreadGeneratorMethod(ThreadRecursionLeak.java:12
    at ClientThread.run(ThreadRecursionLeak.java:27)
    it is just a simple program generating thread recursively with a lock on an object
    import java.lang.Runnable;
    import java.lang.Thread;
    //     <<Objec/Monitor Class>>
         class SomeObject{
              public synchronized void resursiveThreadGeneratorMethod(int threadNumber, int k){
                   if(k<=0)
                        return;
                   else{
                        System.out.println("Thread: "+threadNumber + "call number: "+k);
                        Thread thread=new Thread(new ClientThread(this));
                        thread.start();
                        resursiveThreadGeneratorMethod(threadNumber,k-1);
    //     <<Thread Class>>
         class ClientThread implements Runnable{
              SomeObject someObject=null;
              public static int threadNumber;
              public ClientThread(SomeObject someObject){
                   this.someObject=someObject;
                   threadNumber++;
              public void run(){
                   someObject.resursiveThreadGeneratorMethod(this.threadNumber,10);
    //     <<Driver Class>>
         public class ThreadRecursionLeak{
              public static void main(String [] args){
                   SomeObject someObject=new SomeObject();
                   Thread thread=new Thread(new ClientThread(someObject));
                   thread.start();
    is there any way I can monitor JVM memory status (programatically), kill those threads leading to memory leak and send notification to the system admin.
    We run JVM 1.4 on the server and need to address this issue as we do not have control over the code that can be submitted to the server, we just do some checks and then let it run on the servers.
    Our main requirement is to keep JVM alive and kill all those code and report them.
    Message was edited by:
    rajanikant_malviya

    You can monitor the JVM with the
    [url=http://java.sun.com/j2se/1.4.2/docs/guide/jvmpi/i
    ndex.html]JVMPI if you're using the Sun JVM.This is native code that basically gets
    notified anytime the JVM does something
    interesting.
    However, you're going to have a very difficult time
    catching code that does what the code you show does.
    I'm not sure I understand your environment - you
    allow people to submit code and you run it? Are you
    running it in the same JVM as your server? That
    seems like a huge issue. A simple System.exit()
    code will take down your server.
    Let us know some more details.
    We are actually having a portal through witch users can submit their code, witch are basically utility codes for different operations teams.
    we then provide a way to schedule them.
    At the background, we are having 6 (Win) servers where at each server we are having 20 to 25 users on different ports (managed by our application) running there own JVMs. When a schedule is met we just invoke a servlet (on any free port) and pass code id (stored in DB). And this servlet is responsible for compilation and exicution of the code (We just use Runtime to fork this new process).
    I don't know, but is there any way through witch I can monitor this process and restrict to generate threads recursively???

  • SQL Server 2008R2 SP2 Query optimizer memory leak ?

    It looks like we are facing a SQL Server 2008R2 queery optimizer memory leak.
    We have below version of SQL Server
    Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64)
     Jun 28 2012 08:36:30
     Copyright (c) Microsoft Corporation
     Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
    The instance is set MAximum memory tro 20 GB.
    After executing a huge query (2277 kB generated by IBM SPSS Clementine) with tons of CASE and a lot of AND/OR statements in the WHERE and CASE statements and muliple subqueries the server stops responding on Out of memory in the internal pool
    and the query optimizer has allocated all the memory.
    From Management Data Warehouse we can find that the query was executed at
    7.11.2014 22:40:57
    Then at 1:22:48 we recieve FAIL_PACE_ALLOCATION 1
    2014-11-08 01:22:48.70 spid75       Failed allocate pages: FAIL_PAGE_ALLOCATION 1
    And then tons of below errors
    2014-11-08 01:24:02.22 spid87      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:02.22 Server      Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:02.22 Server      Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:02.30 Server      Error: 17312, Severity: 16, State: 1.
    2014-11-08 01:24:02.30 Server      SQL Server is terminating a system or background task Fulltext Host Controller Timer Task due to errors in starting up the task (setup state 1).
    2014-11-08 01:24:02.22 spid74      Error: 701, Severity: 17, State: 123.
    2014-11-08 01:24:02.22 spid74      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:13.22 Server      Error: 17312, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:13.22 spid87      Error: 701, Severity: 17, State: 123.
    2014-11-08 01:24:13.22 spid87      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:13.22 spid63      Error: 701, Severity: 17, State: 130.
    2014-11-08 01:24:13.22 spid63      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:13.22 spid57      Error: 701, Severity: 17, State: 123.
    2014-11-08 01:24:13.22 spid57      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:13.22 Server      Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:18.26 Server      Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:24.43 spid81      Error: 701, Severity: 17, State: 123.
    2014-11-08 01:24:24.43 spid81      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:18.25 Server      Error: 18052, Severity: -1, State: 0. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:18.25 Server      BRKR TASK: Operating system error Exception 0x1 encountered.
    2014-11-08 01:24:30.11 Server      Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:30.11 Server      Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:35.18 spid57      Error: 701, Severity: 17, State: 131.
    2014-11-08 01:24:35.18 spid57      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:35.18 spid71      Error: 701, Severity: 17, State: 193.
    2014-11-08 01:24:35.18 spid71      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:35.18 Server      Error: 17312, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:35.41 Server      Error: 17312, Severity: 16, State: 1.
    2014-11-08 01:24:35.41 Server      SQL Server is terminating a system or background task SSB Task due to errors in starting up the task (setup state 1).
    2014-11-08 01:24:35.71 Server      Error: 17053, Severity: 16, State: 1.
    2014-11-08 01:24:35.71 Server      BRKR TASK: Operating system error Exception 0x1 encountered.
    2014-11-08 01:24:35.71 spid73      Error: 701, Severity: 17, State: 123.
    2014-11-08 01:24:35.71 spid73      There is insufficient system memory in resource pool 'internal' to run this query.
    2014-11-08 01:24:46.30 Server      Error: 17312, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:51.31 Server      Error: 17053, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:51.31 Server      Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    2014-11-08 01:24:51.31 Logon       Error: 18052, Severity: -1, State: 0. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
    Last error message is half an hour after the inital Out of memory at 2014-11-08 01:52:54.03. Then the Instance is completely shut down
    From the memory information in the error log we can see that all the memory is consumed by the QUERY_OPTIMIZER
    Buffer Pool                                   Value
    Committed                                   2621440
    Target                                      2621440
    Database                                     130726
    Dirty                                          3682
    In IO                                            
    0
    Latched                                          
    1
    Free                                           
    346
    Stolen                                      2490368
    Reserved                                          0
    Visible                                     2621440
    Stolen Potential                                  0
    Limiting Factor                                  17
    Last OOM Factor                                   0
    Last OS Error                                     0
    Page Life Expectancy                             28
    2014-11-08 01:22:48.90 spid75     
    Process/System Counts                         Value
    Available Physical Memory                29361627136
    Available Virtual Memory                 8691842715648
    Available Paging File                    51593969664
    Working Set                               628932608
    Percent of Committed Memory in WS               100
    Page Faults                                48955000
    System physical memory high                       1
    System physical memory low                        0
    Process physical memory low                       1
    Process virtual memory low                        0
    MEMORYCLERK_SQLOPTIMIZER (node 1)                KB
    VM Reserved                                       0
    VM Committed                                      0
    Locked Pages Allocated                            0
    SM Reserved                                       0
    SM Committed                                      0
    SinglePage Allocator                       19419712
    MultiPage Allocator                             128
    Memory Manager                                   KB
    VM Reserved                               100960236
    VM Committed                                 277664
    Locked Pages Allocated                     21483904
    Reserved Memory                                1024
    Reserved Memory In Use                            0
    On the other side MDW reports that the MEMORYCLERK_SQLOPTIMIZER increases since the execution of the query up to the point of OUTOF MEMORY, but the Average value is 54.7 MB during that period as can be seen on attached graph.
    We have encountered this issue already two times (every time the critical query is executed).

    Hi,
    This does seems to me kind of memory Leak and actually it is from SQL Optimizer which leaked memory from buffer pool so much that it did not had any memory to be allocated for new page.
    MEMORYCLERK_SQLOPTIMIZER (node 1)                KB
    VM Reserved                                       0
    VM Committed                                      0
    Locked Pages Allocated                            0
    SM Reserved                                       0
    SM Committed                                      0
    SinglePage Allocator                       19419712
    MultiPage Allocator                             128
    Can you post complete DBCC MEMORYSTATUS output which was generated in errorlog. Is this the only message in errorlog or there are some more messages before and after it.
    select (SUM(single_pages_kb)*1024)/8192 as total_stolen_pages, type
    from sys.dm_os_memory_clerks
    group by typeorder by total_stolen_pages desc
    and
    select sum(pages_allocated_count * page_size_in_bytes)/1024,type from sys.dm_os_memory_objects
    group by type
    If you can post the output of above two queries with dbcc memorystaus output on some shared drive and share location with us here. I would try to find out what is leaking memory.
    You can very well apply SQL Server 2008 r2 SP3 and see if this issue subsides but I am not sure whether this is fixed or actually it is a bug.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • XControl publish subscribe?

    Hi all
    I'm trying to implement a publish subscribe messaging pattern using XControls and LVOOP.
    I have various XControls which represent different views of the state of an object.
    I want all my XControl (clients) to be updated when the object (publisher) changes its state.
    I've achieved this sort of functionality before using VI's running in sub-panels that wait on a user event created by the publisher.
    I gather dynamic events are not available with XControls, so have tried to create a list of XControl clients that could be notified by a XControl method call.
    I've found a way of notifying individual clients by creating a method that fires the Display State ability but really want to manage all the XControls as a collection.
    An array can't seem to store references for the XControls as each is a different type.
    I've also tried using a Data Value Reference for each XControl reference hoping that this generic type could be stored in an array but no joy.
    The only way I've found is for the main vi to register for the publisher user event and then call the notification method of each XControl explicitly.  This messes up the main vi and is not an elegant solution.
    Does anyone know a way of achieving my desired functionality?
    Thanks in advance for any responses!
    Phill
    Solved!
    Go to Solution.

    Thanks tst
    I have attached a little sample of what I thought might be nice.
    I am building a P&I diagram out of DSC elements.
    The valve will ultimatly get more properties like OPC tags, names etc.
    I thought to attach the pipes to it so they get automatically activated, when the valve turns on.
    But I guess that would require some extra programming anyway because there will be two endpoints on the sides of the pipe to control a flow.
    Casting to more generic, even only a control, is obviously not possible. 
    Hierarchy for Xctrl is also not provided, no inheritence.
    Is there any another way to have a class with a Control style FP ?
    I am still at the beginning of the project so I have more options to think of......
    Gabi
    7.1 -- 2013
    CLA
    Attachments:
    Valve.zip ‏149 KB

  • Memory leak in BindingListCollectionView

    When looking at System.Windows.Data.BindingListCollectionView I noticed that it will subscribe to ListChanged on the source, but as far as I could see never unsubscribe.
    Unless I am mistaken this means that the BindingListCollectionView will leak:
    private void SubscribeToChanges()
        if (this.InternalList.SupportsChangeNotification)
            this.InternalList.ListChanged += new ListChangedEventHandler(this.OnListChanged);

    BindingListCollectionView does that in DetachFromSourceCollection, at least in the current version of .NET:
    http://referencesource.microsoft.com/#PresentationFramework/Framework/System/Windows/Data/BindingListCollectionView.cs,196
    This method is supposed to be called by the view manager when it finds that the view is no longer used. AFAIR this is done lazily and it may take a while thus giving the appearance of a memory leak.
    If you have such an issue it would be more useful to create a separate thread and described your case.

  • Memory Leak w/ WebLogic 5.1

    I've created a simple servlet to EJB skeleton and built a stress testing
              tool to make sequential requests to the servlet which in turn creates an
              instance of a stateless session been. Both the servlet and bean do not have
              any real logic in them, just some minimal timing output.
              When run for a few million iterations, the WebLogic JVM slowly leaks memory
              that cannot be reclaimed even with force garbage collection from the
              WebLogic console. Below are 3 snippets of code showing the servlet, the EJB
              call, and the simple client test.
              If anyone else is ecperiencing similar problems or can see a flaw, I'd be
              most grateful.
              Andy
              Servlet code
              protected void doGet(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException
              TestBean bean;
              long requestStartTime = System.currentTimeMillis();
              res.setContentType("text/html");
              PrintWriter out = res.getWriter();
              out.println("<html><head><title>Hello World!</title></head>");
              out.println("<body><h1>Hello World!</h1></body></html>");
              try {
              bean = home.create();;
              bean.testMethod();
              catch (Exception e) {
              totalTime += (System.currentTimeMillis() - requestStartTime);
              Bean code
              public class TestBean implements SessionBean {
              private SessionContext ctx;
              public void ejbActivate() {
              public void ejbPassivate() {
              public void ejbCreate() {
              public void ejbRemove() {
              public void setSessionContext(SessionContext ctx) {
              this.ctx = ctx;
              public void testMethod() {
              Client code
              public void simulateLoad()
              throws IOException
              long totalRequestTime = 0, requestTime, requestStartTime;
              long totalResponseTime = 0, responseTime, responseStartTime;
              try {
              log("Opening connection to "+ url + (debug ? "?debug=true" : ""));
              for (int i = 1; i <= numRequests; i++) {
              HTTPConnection con = new HTTPConnection("localhost",7001);
              HTTPResponse rsp;
              byte data[];
              if ((i % 10000) == 0) {
              log("\nGET Request "+i+" to "+ url + (debug ? "?debug=true" :
              requestStartTime = System.currentTimeMillis();
              rsp = con.Get("/mcumanager" + (debug ? "?debug=true" : ""));
              requestTime = System.currentTimeMillis() - requestStartTime;
              responseStartTime = System.currentTimeMillis();
              if (rsp.getStatusCode() >= 300) {
              log("Received Error: "+rsp.getReasonLine());
              log(new String(rsp.getData()));
              else
              data = rsp.getData();
              responseTime = System.currentTimeMillis() - responseStartTime;
              totalRequestTime += requestTime;
              totalResponseTime += responseTime;
              if ((i % 10000) == 0) {
              log("GET Response "+i+": "+rsp);
              if ((i % 100) == 0) {
              log ("Avg request time :
              "+((float)totalRequestTime/(float)i)+"ms");
              log ("Avg response time :
              "+((float)totalResponseTime/(float)i)+"ms");
              catch (IOException ioe) {
              log(ioe.toString());
              ioe.printStackTrace();
              catch (ModuleException me) {
              log("Error handling request: " + me.getMessage());
              me.printStackTrace();
              

    Please read discussion "WLS dies during stress testing" & "performance
              degradation PROBLEM" in interest.performance.
              Hope it helps.
              Cheers - Wei
              Andy Riedel <[email protected]> wrote in message
              news:[email protected]...
              > I have additional information on this problem. I have replicated the exact
              > same memory leak issue using the included HelloWorldServlet. I use Jrun's
              > ServletKiller stress tool running 16 simultaneous request threads
              requesting
              > the HelloWorldServlet. This WebLogic 5.1 server will leak memory and
              > eventually run out of memory all together with an OutOfMemoryException
              after
              > about 6-8 hours. This indicates that the bug is in the base HTTP Servlet
              > engine code.
              >
              > I have tried turning off the http log (i.e. access.log) as well as
              > notification events from the servlet engine and it still leaks memory.
              >
              > Andy
              >
              >
              >
              > Andy Riedel Chief Architect HearMe Call me through VoiceCONTACTtm -- right
              > from your computer. Online Status:
              > "Andy Riedel" <[email protected]> wrote in message
              > news:[email protected]...
              > > I've created a simple servlet to EJB skeleton and built a stress testing
              > > tool to make sequential requests to the servlet which in turn creates an
              > > instance of a stateless session been. Both the servlet and bean do not
              > have
              > > any real logic in them, just some minimal timing output.
              > >
              > > When run for a few million iterations, the WebLogic JVM slowly leaks
              > memory
              > > that cannot be reclaimed even with force garbage collection from the
              > > WebLogic console. Below are 3 snippets of code showing the servlet, the
              > EJB
              > > call, and the simple client test.
              > >
              > > If anyone else is ecperiencing similar problems or can see a flaw, I'd
              be
              > > most grateful.
              > >
              > > Andy
              > >
              > >
              > > Servlet code
              > > -------------
              > >
              > > protected void doGet(HttpServletRequest req, HttpServletResponse res)
              > > throws ServletException, IOException
              > > {
              > > TestBean bean;
              > >
              > > long requestStartTime = System.currentTimeMillis();
              > >
              > > res.setContentType("text/html");
              > > PrintWriter out = res.getWriter();
              > > out.println("<html><head><title>Hello World!</title></head>");
              > > out.println("<body><h1>Hello World!</h1></body></html>");
              > >
              > > try {
              > > bean = home.create();;
              > > bean.testMethod();
              > > }
              > > catch (Exception e) {
              > > }
              > >
              > > totalTime += (System.currentTimeMillis() - requestStartTime);
              > > }
              > >
              > > Bean code
              > > -----------
              > > public class TestBean implements SessionBean {
              > >
              > > private SessionContext ctx;
              > >
              > > public void ejbActivate() {
              > > }
              > >
              > > public void ejbPassivate() {
              > > }
              > >
              > > public void ejbCreate() {
              > > }
              > >
              > > public void ejbRemove() {
              > > }
              > >
              > > public void setSessionContext(SessionContext ctx) {
              > > this.ctx = ctx;
              > > }
              > >
              > > public void testMethod() {
              > > }
              > > }
              > >
              > > Client code
              > > ------------
              > > public void simulateLoad()
              > > throws IOException
              > > {
              > > long totalRequestTime = 0, requestTime, requestStartTime;
              > > long totalResponseTime = 0, responseTime, responseStartTime;
              > >
              > > try {
              > > log("Opening connection to "+ url + (debug ? "?debug=true" : ""));
              > >
              > > for (int i = 1; i <= numRequests; i++) {
              > >
              > > HTTPConnection con = new HTTPConnection("localhost",7001);
              > > HTTPResponse rsp;
              > > byte data[];
              > >
              > > if ((i % 10000) == 0) {
              > > log("\nGET Request "+i+" to "+ url + (debug ? "?debug=true" :
              > > ""));
              > > }
              > >
              > > requestStartTime = System.currentTimeMillis();
              > >
              > > rsp = con.Get("/mcumanager" + (debug ? "?debug=true" : ""));
              > >
              > > requestTime = System.currentTimeMillis() - requestStartTime;
              > >
              > > responseStartTime = System.currentTimeMillis();
              > >
              > > if (rsp.getStatusCode() >= 300) {
              > > log("Received Error: "+rsp.getReasonLine());
              > > log(new String(rsp.getData()));
              > > }
              > > else
              > > data = rsp.getData();
              > >
              > > responseTime = System.currentTimeMillis() - responseStartTime;
              > >
              > > totalRequestTime += requestTime;
              > > totalResponseTime += responseTime;
              > >
              > > if ((i % 10000) == 0) {
              > > log("GET Response "+i+": "+rsp);
              > > }
              > >
              > > if ((i % 100) == 0) {
              > > log ("Avg request time :
              > > "+((float)totalRequestTime/(float)i)+"ms");
              > > log ("Avg response time :
              > > "+((float)totalResponseTime/(float)i)+"ms");
              > > }
              > > }
              > > }
              > > catch (IOException ioe) {
              > > log(ioe.toString());
              > > ioe.printStackTrace();
              > > }
              > > catch (ModuleException me) {
              > > log("Error handling request: " + me.getMessage());
              > > me.printStackTrace();
              > > }
              > > }
              > >
              > >
              > >
              > >
              > >
              >
              >
              

  • HUGE memory leak when using MP3

    I downloaded a new FME 2.0 and noticed they added an option
    to stream in MP3 format. DO NOT USE that mode (!). If you start
    streaming in MP3 format you will get a huge memory leak on the
    client side. Your browser starts eating memory like crazy and it
    will bury your machine withing an hour or two by taking all the
    memory available. I have proved it on several machines, notifed
    Adobe. They confirmed it as a bug and promised to fix in the future
    releases. Nice, huh? and what people are supposed to do with the
    current build?

    A new build 2.0.1.1114 has been posted . Please try and let
    us know if you face this issue with this build.

  • Full Motion Video - memory leak?

    Good afternoon.
    I am using captivate 1.01.1418.1418 to record and present
    standalone demos of rich client web technologies. The default
    capturing techniques just don't cut it, so I need to record the
    entire demo in full motion video.
    What I have noticed is that when you edit the video AND ALSO
    when running the published demo using either stand-alone or swf
    object methods that there is a huge memory leak. I am talking to
    the magnitude of 20-25 meg / second while displaying full motion
    video.
    My latest presentation is 22 slides where 3 of them are short
    full motion video clips recorded at 1024x768 with no audio. The
    clips are between 30-90 seconds.
    The generated output exe is 6 megs and if I generate it with
    all compression off it is 11 megs. When I run it, my memory usage
    goes to 1.7 GIG of Physical Memory and over 2 GIG of Virtual Memory
    in use. The movie playback then turns solid red and my machine
    hangs up until I can manage to kill the playback.
    Is there a known issue with full motion video and memory
    leaks? I can understand if it took more memory to run it, but using
    3+ gig of RAM to play a 10 meg file? Something sounds off to me.
    I had purchased this product to record and display full
    motion demos and so far it has not been able to meet the needs it
    promised to deliver.
    Any help anyone provides is greatly appeciated.
    Please respond here and/or email me at
    [email protected]
    Thanks in advance for your time.
    -Ray
    P.S. I remember seeing the same behavior on my trial version
    of Captivate 2, however, my trial has expired and I cannot see if
    the leak is of the same magnitude.

    Hi Ray,
    You are experiencing "normal behavior" for the use you are
    putting Captivate to. It was never designed as a full motion video
    capture tool. I won't argue whether or not the marketing people
    ever said it was capable of doing what you say you bought it to do,
    but I really doubt they would make a claim that everyone knows is
    not true ... if you can find something official from Adobe
    asserting that, I'd sure be interested in seeing it.
    The full motion feature was intended to be used to
    demonstrate 2-3 second drag-and-drop operations, or use of a
    scroll bar action of about that duration. In addition, you stated
    you are capturing at 1024x768 size, which is an image of truly
    gigantic proportions - adding to the full motion load you are
    already throwing at the product. Could it be that another product
    is better suited for what you want to do? I'd consider that
    seriously because you are asking more of Captivate than I believe
    it can deliver on anything but a machine designed for 2015
    processor speeds with infinite resources.
    It is especially sad that you own and used Captivate 1.0.1,
    then spent an additional 30 days using the Trial version of
    Captivate 2.0 ... but are just now finding it doesn't do what you
    thought it should do. Again, sorry for your trouble.
    .

  • Callbacks without excessive thread creation and memory leaks?

    Hi JNI experts,
    I haven't done any serious JNI programming in a couple years and I'm currently stuck with a tricky JNI problem:
    My JNI code is connected to a system driver and needs to do frequent callbacks into Java code. The standard way of doing this involves calling AttachCurrentThread and DetachCurrentThread before/after the callback to Java code. However, I noticed that AttachCurrentThread creates a new java.lang.Thread each time it is invoked. Let's just say that the callback is invoked from JNI very freqently, and creating a new Thread each time that happens is not acceptable behavior for my application. Among other things, it prevents me from using the Eclipse debugger because the large number of threads being created and destroyed effectively locks up Eclipse's debugger UI. Also, it creates a CPU load that is way higher than it should be for a light-weight operation.
    So, I deviated from the standard Attach/DetachCurrentThread pattern and moved the DetachCurrentThread to code that is only called when the native JNI service is terminated. As that effectively renders repeated AttachCurrentThread calls a no-op, the problem of excessive creation and destruction of threads went away, but instead I had a memory leak on my hands now. The JNI code needs to create some Java objects because it's easier to create those objects right away rather than passing a bunch of primitives to Java and assembling them into objects there. When I moved the DetachCurrentThread, those newly created objects were no longer garbage-collected even after the Java code had released all references.
    When you print the stack trace of the Java callback method there is always only one frame on the stack (since it is being invoked directly from JNI). However, I suspect that older stack frames from previous invocations keep hanging around somewhere else in memory if DetachCurrentThread is not called. In other words, moving DetachCurrentThread out of the callback is an even worse option. I tried using PopLocalFrame to get rid of left over stack frames, but that didn't seem to work.
    So, my question is: is there a way to make (natively initiated) callbacks from JNI to Java without memory leaks and without creating a new thread each time? Would it work if I created my own native thread that runs some sort of dispatch loop? What other options are there?
    Thanks for any ideas!

    Thanks for the quick reply, ejp! :-)
    Your comments were very helpful; let me clarify a few things:
    I don't know where you get this 'standard Attach/DetachCurrentThread pattern', but if the native callbacks always happen on the same native thread, you only need to attach it once when you get the first callback, and detach it when you get the last, if you can tell. ;-)Yes, the callback is always coming from the same native thread, but, unfortunately, I cannot tell when I get the last callback, and essentially the native service keeps running as long as the VM is running. When I say "standard pattern" I'm referring to the fact that pretty much every book, tutorial, or web site that talks about JNI callbacks shows code snippets where AttachCurrentThread is called, then the callback, and then DetachCurrentThread.
    The JNI code needs to create some Java objects because it's easier to create those objects right away rather than passing a bunch of primitives to Java and assembling them into objects there.Is it really? Are you sure?I'm pretty sure in this case, though your point is well taken. The native API that calls my JNI code produces packets of that contain about 15 pieces of information of different types (ints, longs, doubles). Several packets may arrive together in a single group. Handling the data on the Java side requires a Java callback method with 15 parameters for a single packet, and it's hard to reconstruct which packets belong to one group at that point. Creating corresponding Java objects in JNI and passing them inside an array to the callback function indeed turned out to be easier.
    I don't think just 'moving' the DetachCurrentThread is correct. You need to attach the thread that is doing the callbacks, as often as necessary but no oftener, and detach it when you can.I think I found the solution: my native code is starting a separate dispatcher thread that, as you suggested, attaches itself only once and then enters a dispatcher loop. The low-level call back function notifies that thread of new data via the standard Pthread API. The detach happens in JNI_OnUnload. This works without creating a new thread each time and garbage-collects the created objects properly. As the dispatcher method essentially never returns I also had to insert some DeleteLocalRef calls, because otherwise the local references prevented garbage collection.
    So, for now, it looks like I'm good to go. Thanks again for the reply!

Maybe you are looking for

  • How to use the period in controls?

    Hi, I would like to use a control to validate my current opening balance amounts to the closing balance amounts from the final period in the prior year. However I cannot get it to work as I struggle to find what to enter in the period field for the c

  • Windows 2008 Server Configuration - Help

    Hello All, I am not an expert in configuring servers and I have just started to learn. Please forgive me if I am doing something funny! I have a router with static IP address and DHCP enabled on the router. The router had the following configuration

  • UIX DataObjects - some help please

    I'm doing some interesting things with DataObjects and don't understand why something's happening and would like some help please. An explanation is needed first. Rather than physically delete anything from our system and have all the problems of ref

  • MAC OS X unable to download Cisco ISE supplicant agent

    Hi, I have a problem with MAC OS X clients unable to download the Cisco ISE supplicant agent using Safari browser but able to login on the ISE guest portal. If the same client was to login to the ISE guest portal using Firefox; it has no issues downl

  • Files Are Skipped Upon Initiation of Playback

    A lot of my files were displaying inaccurate time lengths and inaccurate bit rates for VBR files in my iTunes library on my PC until I used a program called VBRFix to solve this part of a problem. However, after running all of these files through VBR