Avoid memory copies

Hi All, 
I am trying to avoid making multiple copies to Improve efficiency. Attached is the vi taken from a larger program. The idea here is to replace 2 D array(Image data) at each iteration, the vi attached shows the first 8 pages of the 3d array is being replaced. This number could change ,that is why I’m allocating 100 pages on the 3d constant. However, the performance of the vi seems to be dependent on the 3d array size which might suggest to me that I’m making data copies for each iteration. In theory, if what we are doing inside the for loop is just replacing the 2D array of 0 to 7 pages, the performance should be independent of the 3d array size? I have used the “show buffer allocation “ tool and there is not buffer allocated at the shift register. Does this mean that we are not making multiple copies for each iteration?
Please advice
Thanks
Attachments:
Inplace.vi ‏130 KB

Well, you array has 31M element, using 120+ MB of memory. This will not fit in the processor cache, so there is some penalty.
You have to be really careful with constant folding, because you are using diagram constants. If I disable debugging in your code, it executes in 0 ms because everything is folded. After replacing the constants with controls to avoid folding, it still executes 20x faster than with debugging enabled. A lot of the overhead seems to be in the debugging code.
(I would also wire the output to somewhere, else the compiler might eliminate the entire thing as part of dead code elimination.)
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • How can I avoid memory leak problem ?

    I use Jdev 10.1.2 . I have a memory leak problem with ADF .
    My application is very large . We have at least 30 application module , each application module contain many view object
    and I have to support a lot of concurrent users .
    as I know ADF stored data of view object in http session .
    and http session live is quite long . when I use application for a while It raise Ouf of Memory error .
    I am new for ADF.
    I try to use clearCache() on view object when I don't use it any more .
    and call resetState() when I don't use Application Module any more
    I don't know much about behavior of clearCache() and resetState() .
    I am not sure that It can avoid memory leak or not .
    Do you have suggestion to avoid this problem ?

    ADF does not store data in the HTTP session.
    See Chapter 28 "Application Module State Management" in the ADF Developer's Guide for Forms/4GL Developers on the ADF Learning Center at http://download-uk.oracle.com/docs/html/B25947_01/toc.htm for more information.
    See Chapter 29 "Understanding Application Module Pooling" to learn how you can tune the pooling parameters to control how many modules are used and how many modules "hang around" for what periods of time.

  • Free memory after using GetRS232ErrorString() to avoid memory leak?

    Hello,
    Is it necessary to free memory after using function GetRS232ErrorString() to avoid memory leak?
    Example 1:
    int main();
    char *strError=NULL;
    strError = GetRS232ErrorString(55); /* just an example for error message */
    free(strError ); /* Do I need to free this pointer? */
    Example 2:
    int main();
    MessagePopup ("Error", GetRS232ErrorString(55)); ; /* Will I get a memory leak with this function call? */
    BR
    Frank

    It's a pity that the documentation is indeed so poor in this case, but testing shows that it always returns the same pointer, no matter the error code, so it seems to be using an internal buffer and you are not supposed to free the string (but need to copy it before the next call to GetRS232ErrorString if you need to keep the text). It does however return a different pointer for every thread, so atl least it seems to be thread safe.
    Cheers, Marcel 

  • How to avoid multiple copies of data in page refresh

    How to avoid multiple copies of data in page refresh

    If you are talking about a page with an insert query, ignore the fact that it's a page refresh.  It's just another way that someone can insert duplicate records.  I like to handle this in my insert query.
    insert into thetable
    (f1, f2, etc)
    select distinct
    value1, value2, etc
    from some_small_table
    where you don't already have that record

  • Best practice with Listeners to avoid memory leaks

    Hi guys,
    I'm using Javafx to develop an application. I'm creating views with fxml. I'm experiencing some memory problems perhaps because I can not understand the life cycle of the controller and the views.
    For example, the listeners that I add in the controller to the components of ui, must be removed before going out from the view?
    And in a case in which there is a inner listener? For example:
    tabellaClienti.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Cliente>() {
                   @Override
                   public void changed(ObservableValue<? extends Cliente> property, Cliente oldSelection, Cliente newSelection) {
                        seleziona(newSelection);
              });in this case the listener when is destroyed?
    I'm experiencing that I got the same view (with all components) in memory many times.
    There is a guideline to follow to be sure to avoid making mistakes?
    Thanks!

    You should either remove your listener or, if you don't know when (because you lose track of your tabellaClienti), you can use WeakChangeListener.
    http://docs.oracle.com/javafx/2/api/javafx/beans/value/WeakChangeListener.html
    But I wonder why there a leaks at all, because you listener is only in the view and not on another reference, so it can be garbaged collected.
    Note that you must have a private class variable in you view holding a reference to your ChangeListener then.
    Do you know a good tool, how you can see which objects are in memory and cannot be garbaged collected? We constantly have memory issues, too...

  • How to tune the MDX queries to avoid memory pressure? Please Help!

    I tried to run the following mdx queries, but kept running into Memory pressure issue.  Could someone give me some suggestions to avoid the issue?
    Thanks a lot
    Executing the query ...
    Server: The operation has been cancelled due to memory pressure.
    Execution complete
    ======================Query 1=============================
    SELECT NON EMPTY { [Measures].[Net Purchased CPP] } ON COLUMNS, 
     NON EMPTY {  ([STATION].[Station Name].[Station Name].ALLMEMBERS 
     * [DAYPART].[Daypart Code].[Daypart Code].ALLMEMBERS 
     * [DEMOGRAPHIC].[Demo].[Demo].ALLMEMBERS ) }  ON ROWS
     FROM [SPOT]
     WHERE  ([ESTIMATE].[Estimate Number].&[3881] )
    ==================Query 2================================     
       SELECT NON EMPTY { [Measures].[Net Purchased CPP] } ON COLUMNS, 
     NON EMPTY {  ([STATION].[Station Name].[Station Name].MEMBERS 
     * [DAYPART].[Daypart Code].[Daypart Code].MEMBERS 
     * [DEMOGRAPHIC].[Demo].[Demo].MEMBERS ) }  ON ROWS
     FROM [SPOT]
     WHERE  ([ESTIMATE].[Estimate Number].&[3881] )
     =====================Query 3============================   
    SELECT NON EMPTY { [Measures].[Net Purchased CPP] } ON COLUMNS, 
     NON EMPTY { ([ESTIMATE].[Estimate Number].[Estimate Number].ALLMEMBERS 
     * [STATION].[Station Name].[Station Name].ALLMEMBERS 
     * [DAYPART].[Daypart Code].[Daypart Code].ALLMEMBERS 
     * [DEMOGRAPHIC].[Demo].[Demo].ALLMEMBERS ) } 
     ON ROWS FROM ( SELECT ( { [ESTIMATE].[Estimate Number].&[3881] } ) ON COLUMNS FROM [SPOT])

    Hi BI_Eric,
    The error occurs on the following scenario.
    You run a Multidimensional Expressions (MDX) query that contains a Data Analysis Expressions (DAX) measure in Microsoft SQL Server 2008 R2 Analysis Services (SSAS 2008 R2).
    The DAX measure has an expression that contains many levels of nested binary operators.
    Applying SQL Server 2008 R2 Service Pack 1 will fix the problem, please refer to the link below.
    http://support.microsoft.com/kb/2675230
    Besides, enough to seriously impair performance.you used CrossJoin function to join multiple dimensions which might cause the performance issue. If you crossjoin medium sized or large sized sets (e.g., sets that contain more than 100 items each), you can
    end up with a result set that contains many thousands of items enough to seriously impair performance.http://social.msdn.microsoft.com/Forums/sqlserver/en-US/337aea24-09ff-4354-b67d-8a90f67a13df/memory-pressure-error?forum=sqlanalysisservices
    Regards,
    Charlie Liao
    TechNet Community Support

  • How do I avoid keeping copies of messages in Mail?

    I have a really low capacity MacBook Air. Earlier this year, I discovered I could keep it usable without a bunch of "running low on disk space" warnings by limiting the caching performed by Safari and Mail. In Safari it was easy, it's in Preferences, but in Mail it was a bit buried - select the account, advanced tab, and then "don't keep copies of any messages".
    Problem is, it seems like in Mavericks this preference is gone. Is there an equivalent? I'm out of room on my Air once again.

    @Lanny: For the record, I am not keeping a copy of every single email–emails are kept selectively and folders are well-organized. Attachments are stripped unless strictly needed. The problem isn't just size, it is the amount of files copied, and the number of devices onto which your emails are duplicated across. It is just wasted bandwidth and storage space. Nevertheless, even with selective mail handling the total amount of storage  easily number a couple of gigabytes if you have a couple of years worth of emails.
    Your suggestion to use POP3 instead of IMAP would be more relevant if Mail.app had retained the 'Do not keep copies of any messages' setting when setting up your account as POP3 instead of IMAP. However, it does not. The setting is not present anymore in the Mail.app version shipped with OSX Mavericks–regardless of whether POP3 or IMAP is being used.
    Furthermore, what you describe as the 'main features and advantages of using IMAP' is simply not correct. Every mail client by default copies your messages from the server for use locally. Where IMAP differs is that one can subscribe to commonly-used folders (which will be synchronized and kept up-to-date on the client), whereas less frequently-used folders only reside on the server. These emails can be accessed quickly thanks to IMAP's efficient search mechanisms–both for header or full-text searches. So in short it has much better ways of locating your messages that conventional POP3 clients have. There is rarely a need to have a local copy at all.
    It actually appears that you have mixed up IMAP and POP3, as the IMAP 'advantage' you are stating is specific to POP3. With POP3, email is  stored on the server until you check your email, where it is fetched from the mail server and stored locally–often with the remote copy expunged–which is the complete opposite of what is intended.
    The differences and benefits of using IMAP vs. POP3 are explained here:
    http://mail2web.com/blog/2010/02/pop-imap-difference/
    Your other suggestion regarding upgrading the harddrive simply to store multiple copies of email is a rather questionable solution if you ask me, as the SSDs are welded onto the MacBooks and cannot be replaced without tearing it apart (or spending a huge amount of money to have it serviced by Apple in order to do so). There is also the question of justifying a purchase of a bigger drive just because Apple removed an option in one of their core applications.
    So my question as to why this core IMAP functionality was removed still stands. This is clearly an impairment of functionality which should be dealt with by Apple instead of forcing its users to abandon the way mail is being accessed, or resorting to expensive and cumbersome workarounds.

  • Deploy reports in ssrs which are renamed and avoid multiple copies

    Hi, I have renamed few of my reports renamed and checked in. Usually we deploy it from BIDS off of TFS reports solution. We are using SQL Server 2008 R2 version. I tried deploying these reports to DEV & QA environments and report manager has 2 copies
    of the same report one with the old name & the other with the rename. What would be the approriate way to delete these reports from Production without having to do it manually.
    Thanks in advance...........
    Ione

    You have to delete them manually in this case. 
    There is no way around it.
    Thanks! Josh

  • What is the best way to create diagonal array in order to avoid MEMORY IS FULL error created by using INITIALIZE ARRAY vi?

    Using the values in a 1D array, I need to place them along the diagonal of a 2D array. Currently, I've been using INITIALIZE ARRAY VI to create 2D array of zeroes and then usE REPLACE ARRAY SUBSET to put the 1D array values on the diagonal. This works sometimes but I often get an error stating that the memory is full and that the application was stopped at INITIALIZE ARRAY.
    I'd appreciate any advice on how to stop this from occuring.
    Thanks and happy holidays,
    Hunter (LabView 6.1 user)

    Weather is the same here, too.
    Sorry about the PDF. I had forgotten about the PRTSCN option. See the attached JPG.
    I'd send you an example input that is giving me problems but today, my computer seems to be behaving and the error hasn't popped up. This makes me believe that it's truly a memory problem with my machine.
    This VI is a subVI used in several computationally intensive applications.
    If you're still interested in playing with it, I will email it to you. Please send me your address. In fact, I see you're in the oil & gas industry and I'd like to hear what you're working on since I work in that industry as well.
    Thanks again, Hunter ([email protected])
    Attachments:
    VI_Diagram.jpg ‏104 KB

  • Can I specify instance on R/3 side to avoid memory buffer issue

    I have one datasource (out of many that work A-OK every day) that likes to throw a TSV_TNEW_PAGE_ALLOC_FAILED short dump intermittently on the source system extract.  The short dump occurs in the background job that was created by running the infopackage in BW.  The short dump occurs on an internal table as the extractor is building the packets to be sent to BW (at least, that is how it looks).
    We have 16 instances on our source system.  The short dump has happened on several different ones -- it seems to be whereever the batch job happens to be scheduled.
    That brings me to my question.  Some of the 16 instances have higher heap total settings than others.  That is because some are configured more for batch work than others.  On the R/3 side, of course, I can assign batch jobs to instances as I create them.  But what about batch jobs that are spawned from the BW-side.
    Is there a way to control the instance where the extract batch job runs?  It seems you can set an app instance for all extracts  if you want -- but, of course, that would not be good for me.  In general, I want to use batch processes across many instances. 
    I want to control where this one specific datasource runs its extraction, so I can point it to a high-memory instance.
    Thanks for any help.

    Roger Burrows
    while scheduling the Job it self you direct specific long running job/Large Volume of Records Job to specific server which has more capicity so that this particular job will run on that specific server only.
    Thanks
    sat

  • What needs to be released to avoid memory leaks in the jvm?

    I've got a C application server that makes Java calls to process requests.
    Eventually, the JVM runs out of memory, I assume because my C code is leaking references.
    My question is... what references should I be freeing? I am freeing local/global object references, but it still leaks memory.
    Should I also be freeing classIds? Method ids? Is DeleteLocalRef() the way to do that?
    Thanks,
    Jeff

    The simple answer is that you are responsible for deallocating every single reference (basically anything that isn't either a fieldID or a methodID) that is returned from a JNI call. The return value from each JNI call is a newly allocated local reference that you must delete with a call to DeleteLocalRef. For example, you must delete the jclass returned by FindClass() or the jthrowable returned by ExceptionOccurred(). In addition to that, you must also ensure that you delete any global references that you explicitly allocate yourself.
    Notice that the rules change, when you are executing from within the context of a native method invoked from the JVM. In that case, the JVM will automatically clean up any local references that are left over once the native method returns. Even then, though, it's smart to be careful with local references, because you can easily exceed the maximum number of local refs, or hold on to excessive amounts of objects, or hold onto objects for excessive amounts of time, because none of the local refs are deallocated by the VM until the native method actually returns.
    Local reference management is a real pain in the butt in JNI. For example, it took me quite some time to get it right in Jace.
    God bless,
    -Toby Reyelts
    Check out the free, open-source, JNI toolkit, Jace - http://jace.reyelts.com/jace

  • To Avoid illegal copies

    I have jus finished my project, I am thinking on selling it; the problem is that (obviously) I dont want to somebody makes illegal copies of it.
    I was thinking in checking the mac address so, it will only work in one machine with a specific NIC. But, what if somebody get the classes that are in my jar file and use it; how I can get all my project in one class so no one can read it, or make some use of it.
    Could somebdoy give me some tips, or where to get info about how to protect java software?

    Try obfuscating your Java bytecode, using an Java obfuscation tool. Just search online for Java obfuscation tools, and you'll find quite a few. I believe Sun used Dash-O to obfuscate their JCE code.
    SCJP, SCJD, SCEA, SCWCD, SCBCD
    CISSP, PMP, PHR
    OCPDBA 8i/9i
    http://www.certgear.com

  • How to avoid multiple copies of the same application in Web Start cache?

    We have an environment where there are several HTTP servers carrying the same Web Start application.
    Is there any way to prevent Web Start from installing another copy of the same application in a client machine's cache if the user hits an HTTP server that is not the one the application was already installed from?

    There is no way WebStart can know that an application from one server is actually the same as an application from another server, so I don't think this is possible.

  • Is there any way to avoid duplicate copies of .docx and .pages files?

    I frequently download .docx files (and .pptx/.xlsx, but let's just stick with .docx for now).  I'm getting used to the pages format, except every time I try to modify a .docx file, I can't save it again without creating a new file.  Ultimately I'll end up with a .docx version and a .pages version of the same file.  Is there any way to edit and save just the .docx version?  Or maybe even have the original .docx version replaced by a .pages version?

    When you open a Word document with Pages you get a translated-to-Pages file & the original Word document is unchanged. There are programs that will save over the original file such as LibreOffice. Pages will not.

  • Best Practices for EJB--memory leak avoidance

    I an researching a memory leak. From what I can tell, we do not want to put any instance variables at the class level. This would incur a memory leak when the ejb containers creates the ejb.
    I am wondering if there are any more 'best practices' with EJBs that prevent memory leaks. A good site would help me too
    Russ

    Thank for your reply.
    You are right. I was referring to stateless session
    beans.
    What I was thinking was the following:
    1. Making parameters final unless the parameter
    r state is changed inside a method.Won't help with memory leaks. There are benefits for an object being immutable, but I don't think that it eliminates the possibility of the object being leaked.
    2. All instance variables in stateless session beans
    s should be set to null upon ejbPassivate and
    ejbRemove operations. The variables should be
    populated on ejbCreate and ejbActivate.Optimizing compilers don't need the hint of setting the reference to null. I don't think that helps, but I'm not 100% certain.
    3. Before throwing an exception at the session bean
    level, clear up all the instance variables by setting
    them to null.Shouldn't scope make it clear to the GC that the objects aren't needed? If they're all primitives, how does this help memory leaks?
    I am using a profiler to identify the objects still
    being held onto once GC, but I was hoping others with
    more experience than I would share some of their tips
    on how they avoid memory leaks.I don't know where you're getting these tips, but I don't think they're helpful.
    Collections and Singletons would be the places where I'd look. If you add a reference to an object that holds onto it in a collection and never lets go, the GC won't reclaim it.
    Singletons aren't cleaned up, because their instance is static. Anything the Singleton refers to won't be cleaned up unless the Singleton relinquishes the reference.
    Look for things like that. I think they matter more.
    %

Maybe you are looking for

  • [Solved] Systemd broke KDE

    OK, well, looks like my problems weren't actually gone. So i recently upgraded and switched to systemd and all that. I did go through the wiki for systemd and KDE and run the commands to start kdm on boot, and after a few other minor issues I managed

  • Free Items in Import Purchase Order

    Hi All, How to handle a FOC materials ( No payment to Vendor) in Import PO. I have an Import Purchase order (FOC items) with all the applicable Duties and i have to pay only the Duties to the Customs and not to Vendor. How to handle this scenario in

  • Problem with common services discovery !

    hi, I have set the network discovery setting to use (arp-ospf, and cdp) . after the network discovery was finished I found out that there are 30 devices which had been discovered but in unreachable state !!!! I start to ping all those devices and hop

  • How much is tax? And how much is cancellation?

    I want to get the Photoshop deal where I pay $9.99 a month, how much tax would be added monthly? Also, if I ended my contract, let's say in 8 months, how much would it cost to cancel?

  • ERMS issue on CRM5

    Hi ERMS experts I have problem whereby Emails are not routing to default Org Unit as configured The responsible group is not automaticaly populated with Org Unit as configured when I see incoming email in Agent Inbox, instead its blank This is what I