What is meant by a resource leak ?

What is meant by a resource leak ?

Garbage collection manages only memory, not other system resources. If your Java program has plenty of free memory, garbage collection will not be triggered automatically. Usually, however, there are other resources that are more limited than memory. For example, all OSes have limits on the number of sockets, file handles, etc. that can be open. Sometimes this limit is quite low. This is true even on a desktop, e.g. if your system has 128KB of memory, your Java program can easily allocate all the available file handles without coming near to filling up the heap. If this happens, your Java program will fail. This is what we call a resource leak; the unintentional maintenence of references to non-memory resources.
This is why it is important in Java to explicitly manage non-memory resources. Classes which utilize non-memory resources should provide ways to explicitly allocate/deallocate those resources, independent of garbage collection. For example Socket, InputStream and OutputStream each provide explicit close() methods for deallocation of file descriptors, Window provides a dispose() method to free the window handle, etc. The way to properly use these classes is to allocate using the constructor, then deallocate using the appropriate method (deallocation is preferably done in a finally{} block, so it will execute whether or not an exception is thrown during use). These classes do release these non-memory resources in their finalize() method, but remember that the finalizer only gets called by the garbage collector, and if the object is never collected, it will never be finalized, hence will never release the resources.

Similar Messages

  • What is meant by resource constrained devices

    what is meant by resource constrained devices

    what is meant by resource constrained devicesIn general a platform with limited system resources such as memory, display resolution etc.
    In practice it typically means mobile phones, pda's and stb's.

  • Finalize prevents "resource leak"?

    As far as I can tell, " +Effective Java+ " (by Joshua Bloch) is the most recommended Java text. Therefore, I am assuming the author is credible, maybe on par with the best on this forum. Then, here is a quote from the book:
    ".... there is a severe performance penalty for using finalizers... So what should you do instead of writing a finalizer for a class whose objects encapsulate resources that require termination, such as files or threads? Just provide an explicit termination method, and require clients of the class to invoke this method on each instance when it is no longer needed."
    I question the advisability of designing a class such that the design says "oh. by the way. when you are done using an instance of it, don't forget to call this method." Would not such a design lead to hard to find, easy to forget, resource leaks (same idea as memory leaks ). Is such a (dangerous?) practice used in real-world apps?
    btw:
    The issue of finalizers arose while reading about java.awt.Graphics . I read that if "g.dispose()" was not called on every instance of Graphics , if run long enough, with 100% certainity, an app would come crashing down. Some resource is exhausted. Know when it must be explicitly called, and then always put that method in a finalize block.

    tatsuke wrote:
    try {
    ArrayList<Double> list = new ArrayList<Double>();
    for(int d = 0; d < Double.MAX_VALUE;d++) {  list.add(new Double(d));  }
    } catch (java.lang.OutOfMemoryError e) {
    // forces gc to kill all possible objects, each's finalize block is executed?
    // next, not sure what to do in any practical sense.
    // just checking that i understand what is going on.
    First of all, If I ever find any code like this in an production environment during a code review, then the author of that code will get a very strict talking-to at least.
    I can't begin to tell you how wrong this is and at how many levels.
    First of all: Who tells you that the OOM-Error is thrown in this code and not in an entirely unrelated code in another Thread that happens to be the first one to request too large a block of memory? (Not unlikely, since you allocate a lot of tiny objects and the OOM-barrier can easily be hit by another thread that tries to allocate a 512k buffer for some I/O operation.
    Next: you're taxing the memory settings of the JVM, forcing it to go up to its maximum size, even when the actual requirement would a fraction of the maximum size and thus potentially forcing your application (and others) into swap and slowing them down to a grinding halt, effectively producing a denial-of-service.
    Next: you produce an infinite loop, because you'll never reach Double.MAX_VALUE (try printing "Double.MAX_VALUE" and "Double.MAX_VALUE - 1d" and tell me the difference).
    Next: no-one said that it's possible that the object is never collected and never finalized in all situations. Of course there are situations when it has to be collected (OOM is about the only one that comes to my mind, at the moment). But that doesn't mean that you can rely on finalize() being called in all situations. Note that nothing in the spec tells you that the GC must run when you run out of file descriptors. Running the GC could help, if someone forgot to close a stream, but it is not enforced.
    Next: yes, I'm pissed of at something entirely unrelated and you just happen to be there. Sorry for that. I still think the content of my comments is correct.

  • What is meant by cost element

    hi
    what is meant by cost element

    HI.
    Differentiation of Cost Elements
    Use
    In call management, it is necessary to differentiate cost elements further for the settlement of orders in profitability analysis. Both the costs incurred and the sales deductions are classified according to their source, and assigned to the appropriate cost elements. For example, the following costs are differentiated:
    Sales costs
    Warranty costs
    Good will costs
    Sales deductions due to warranty
    Sales deductions due to good will
    The differentiation of costs and sales deductions enables you to assess more accurately the profitability of your products.
    Integration
    The differentiation of cost elements is only of use if the service orders are settled in profitability analysis.
    Prerequisites
    Resource-related billing must be performed for service orders.
    You must have defined the accounting indicator in Customizing for Plant Maintenance.
    When you create a service order, you define the accounting indicator in the header, under administrative data. Currently it is only possible to have one accounting indicator per order.
    Once the order is released, the accounting indicator can no longer be changed in the order header.
    Features
    When actual postings are made for a service order, the system creates CO single records and a CO totals record. When doing this, it copies the accounting indicator defined in the order header, and enters it in the origin of the totals or single records.
    In addition to the variance class and the cost element, the accounting indicator is a further characteristic of the PA transfer structure.
    The transfer of the accounting indicator to the origin also makes it possible during the settlement of a service order in profitability analysis, to navigate more specifically in the PA transfer structure. The costs and sales deductions for warranty, good will, and sales are entered in the respective value fields.
    Reward all helpfull answers.
    Regards.
    Jay

  • What is meant by functun module

    Hi Gurus,
        Can you please explain me what is meant by function modue and importance of this?
    Thanks in advance
    venkat

    Hi Venkat,
    Your question is not clear as to whether you want to about function module in ABAP or a Functional module. Anyway..........pls find answer for both below -
    <b>ABAP function module</b> -
    Function modules are procedures that are defined in special ABAP programs only, so-called function groups, but can be called from all ABAP programs. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder.
    Function modules allow you to encapsulate and reuse global functions in the SAP System. They are managed in a central function library. The SAP System contains several predefined functions modules that can be called from any ABAP program. Function modules also play an important role during updating  and in interaction between different SAP systems, or between SAP systems and remote systems through remote communications.
    <b>SAP Functional Module -</b>
    SAP functional module represents each functional area of an organisation. Each module helps in mapping respective business processes into SAP. The following is the broad bifurcation of Functional Modules -
    ACCOUNTING -  FINANCIAL ACCOUNTING Module
    LOGISTICS - SALES AND DISTRIBUTION Module, MATERIALS MANAGEMENT Module, QUALITY MANAGEMENT Module, PRODUCTION PLANNING AND CONTROL Module
    PLANT MAINTENANCE Module
    PROJECT SYSTEM Module
    HUMAN RESOURCES - HUMAN RESOURCE Module
    <b>Reward if helps</b>
    Regards
    Sai

  • What is meant by 3tier

    difference between sap& erp.
    what is meant by 3tier architecture?what are advantages & disadvantages of 3tier.architecture.

    Hi,
    SAP means System Application n Products in Data Processing.First it was an MRP package ie; Material Resource Planning. Later they thought that SAP has mnay modules like SD,MM,PP,HR FI/CO etc..... So first its the work of the HR to get the project..Later we MM people they take care of the material .....n then finance like that it has formed an organization....From then it has changed from MRP package to ERP package.We have 31 ERP packages out of them we have people soft, seibles, Oracle Finanace,L . D Edward, BAAN,RAM Co, SAP-68% etc....
    In three Tire Architecture :
    It is mutually independent as well  as mutually independent.
    It consists of  Presentation layer, Application layer and Data base Layer.
    Presentation Layer is a Graphical user-interface.
    Application Layer deals with sales n distribution.
    Data base layer consists of all the data that is required for processing.
    The advantage in three tire arch is that even though if there is an error in one application module eg ; like in fi/co it does not effect the other application modules....so it is independent as well as dependent also....
    It is also called as a Client-Server Architecture.
    First is the Presentation Layer then comes Application Layer n then is the Data base Layer.
    Dialog Server acts like an Interface between Presentation Layer n Application Layer.
    Update Layer acts like an interface between Application Layer and data base layer.
    So these r the main points in SAP R/3 architecture.
    if useful reward with points,
    with regards,
    madhuri.

  • What is meant by costing key?

    Dear Experts ,
                          while releasing the billing document to accounts , i am getting  error like
                Valuation with material cost estimate: error, The system looked for the material cost estimate using costing key "002", as defined in the Customizing settings for CO-PA,  incomplete due to FI/CO interface
    what is meant by costing key?
    regards
    rajakarthik

    Hi,
    In Costing based Profitability analysis you define costing keys. A costing key is a set of access parameters which are used in valuation to determine which data in Product cost planning should be read. In the costing key you attach the costing variant.
    In the costing key you specify whether the system should read the current standard cost estimate, the previous standard cost estimate or the future standard cost estimate or a saved cost estimate.
    The configuration settings to determine this costing key is as follows:
    Assign costing keys to the products u2013 Three costing keys can be attached to a single product for a specific point of valuation, record type, plan version.
    Assign costing keys to Material types
    Assign costing keys to any characteristics u2013 You can use your own strategy to determine the costing keys. This is through user defined assignment tables.
    regards,
    Santosh kumar

  • Dispute Case Key (Replicated) (0DPM_D10); what is meant by Replicated?

    Hi everyone,
    I am working on implementing FSCM Dispute Managment module. I have some questions regarding the new standard content provided by SAP for this:
    Earlier I have seen clients using the Stanadard InfoSet 0DPM_I0 for all the Dispute's reporting as it combines data from AR, Dispute Case key and 0Customer. But now I am seeing a bunch of new objects like 0DPM_M10, 0DPM_M20, 0DPM_C10, 0DPM_D10, 0DPM_DCAS_10 etc. provided by SAP as standard content.
    Does any one have any experience with this new content; can anyone explain me how this new content is useful. My client is reluctant against using the standard InfoSet as its is built on two DSO's; I have suggested to build a cube on top of them and can still use an InfoSet to combine AR line items, Disputes, Dispute case key and Customer. Correct me if I am wrong with thid statement.
    Also please let me know what is meant by a Replicated DSO.
    Any comments or suggestions will be greatly appreciated.
    Thanks & Regards,
    SRV

    There are a few things to consider:
         1) The data is stored in deserialized form until it is read. The first read will deserialize the data.
         2) There is some overhead per-entry. 750MB/(3,000,000-30) = ~250 bytes per entry. Some portion of this is attributable to the per-entry overhead.
         3) How did you measure memory usage? Usually invoking <tt>System.gc()</tt> before measuring heap usage will clear garbage but is not guaranteed.
         Jon Purdy
         Oracle

  • What is meant by criteria of Updateability in MDM Import manager

    Hi,
    What is meant by criteria of Updateability in MDM Import manager? i read some information, but i could understand, it says original data source be  updateble. what is meant by Original data source.?
    what is the use of option "Read-only"  in Import manager logon screen.
    Thanks

    Hello Ankam,
    You can check the Read-only option to prevent MDM from updating your data source.
    Kindly see the below information on "DATA SOURCE UPDATES"
    DATA SOURCE UPDATES
    Some MDM Import Manager operations require that the original data source be updateable, thereby allowing new fields and/or entire new tables u2013 and the corresponding data values for each record u2013 to be automatically added to the data source before further processing.
    Other operations simply create virtual fields in the MDM Import Manageru2019s workspace, although if the data source happens to be updateable, some of these operations instead add the new fields to the original data source as well.
    NOTE ►► Updating the data source when possible allows you to
    perform additional operations on the new fields as if they were part of
    the original source data, and also use them as record matching fields.
    NOTE ►► Fields that are added only if the data source is updateable
    can be deleted automatically by the MDM Import Manager when you
    exit or switch data sources based on the setting of the Delete Created
    Fields on Exit configuration option.
    Updateable Data Sources
    Whether or not a data source is updateable depends upon the following:
    u2022 Source type. The source Type must permit the MDM Import Manager to update its schema and insert the additional fields of data; some supported types are updateable and some are not.
    u2022 Media. The media on which the data source resides must itself be updateable. If the media on which the data source resides is readonly, such as a CD-ROM, the data source cannot be updated.
    u2022 Permissions. You must have the proper file system permissions to update the file, or the proper DBMS permissions to update the schema of the database.
    u2022 Read-only option. You cannot have checked the Read-Only option, which prevents MDM from updating the data source even if the other conditions would otherwise permit it.
    NOTE ►► The Read-Only option is: (1) enabled for source types that
    can be updated (Access, Oracle, SQL Server, and XML); (2) disabled
    and unchecked for those that use Access as an updateable staging
    area (Delimited Text and Fixed Text); and (3) disabled and checked for
    those that cannot be updated (Excel and ODBC).
    NOTE ►► When the data source is SQL Server, the table names in
    the database must not contain spaces; otherwise any operation that
    would update the data source will fail.
    Hope this helps.
    Regards,
    Vikas

  • What is meant by 'Business Area'

    Hi all
    what is meant by 'Business Area' in discoverer?
    Because i have installed BI Tools Discoverer Admin and Desktop
    but unable to figure out what Business Area atcually is!!!!
    Thanks in advance
    Regards

    Hi,
    what is meant by 'Business Area' in discoverer?
    Business area is nothing but a set of folders specified to that responsibility.
    Seems your novice so to know concepts of BI and develop discoverer reports follow this user guides which can be downloaded from oracle site.
    [http://download-west.oracle.com/docs/html/B10270_01/toc.htm]
    [http://download.oracle.com/docs/cd/B14504_01/dl/bi/B10272_01/toc.htm]
    Hope this helps you,if anything more feel free to ask we are ready to help you.You will find Discoverer interesting as you go on working with it.Have a nice time working on it.
    Best Wishes,
    Kranthi.
    Edited by: Kranthi.K on Jun 16, 2009 7:29 AM

  • What is meant by stacked list

    hi
    what is meant by stacked list

    Hi Jyothsna,
    A stacked list is a list used in Module Pool programming.
    In an ideal scenario,you will define the screen sequence in either a static or a dynamic way.
    By the statc way,you define the next screen and enter the next screen's value in it.
    By the dynamic way,you code the statement CALL SCREEN XXX where the XXX means the screen number.The dynamic way overrides the static way of defining the screen sequences.
    Now,if you want to insert a screen sequence,i.e a sequence of screens which are not defined in the same ABAP program,you either do it by static or the dynamic way again using the above constructs.
    But in this case,a stack is loaded for a screen sequence and the screens are processed based on the sequence defined in it.
    Before leaving this screen sequence,you should always destroy or delete it usng the keyword LEAVE as it occupies a lot of memory.
    In case you have any further clarifications,do let me know.
    Regards,
    Puneet Jhari.

  • What is meant by noted items

    hi all,
    can any one explain me what is meant by noted items incase of G/l ,AR & AP. as i found this word in FBL3N ,FBL1N & FBL5N also?
    thanks in advance...
    regds,
    raman

    Hi,
    Unlike manual accounting, you  can make certain transaction in SAP which don't have a impact on accounting but are necessary for dicision making or related to any future transactions. These are called Noted items. Noted items are only posted to one side of accounting.
    Eg: If we send a request to customer for down payment, it is not a business transations and have no impact on accounting, but we can pass a entry in SAP for such transaction and it will be a noted item. When actual down payment is received, this noted item is cleared.
    Reward points if answer is helpful.

  • What is meant by qualified advance payment?

    HEllo,,
    what is meant by qualified advance payment. I was reading the SAP help but couldn't understand. so, plz explain in  simple terms.
    Thanks,
    JEss

    Definition:
    With qualified advance payments, payroll takes place for some of the payroll elements in the first payroll run, and is transferred if necessary. The payroll run is not ended. Instead, it receives the Payroll Correction status. During the correction phase, you enter more payroll elements. In the subsequent payroll runs you carry out payroll for these remaining payroll elements and transfer them to your employees. The payroll program only finishes when accounting has been performed for all payroll elements.
    Just do this simple transactions:
    1. Maintain master data, example salary 1000 EUR
    2. Release payroll
    3. Run payroll u2013 will generate /559 1000 EUR (assume no other deduction)
    4. Process Bank Transfer, will generate 1000 EUR, don't forget to set flag for transfer >> employee get payment earlier than it should be, for example get the 1000 EUR in the middle of the month. >> it is qualified advance payment.
    5. Payroll Correction
    6. Change salary to 3000 EUR
    7. Release payroll
    8. Run payroll u2013 will generate /558 2000 EUR (3000-1000) and /564 1000 EUR
    9. Process Bank Transfer again, will generate 2000 EUR. >> normal regular payment, at the end of the month.

  • Changing up what happens at the 'select resource - queued' step

    Greetings!
    So, I'm curious .. we'd like to change how we do things regarding what happens at the select resource - queued step. Our current state is a series of business checks, place the call on hold, play CUCM MOH, take the call off hold, go back to the queue loop and repeat.
    To change things up I'd like to play some royalty-free music as a prompt instead of putting the call on hold. I would use boolean flags to keep track of what prompts have played so callers do not hear the same wav file over and over and over.  So, I'm thinking of doing something like this ...
    At the queued step ..
    play a prompt
    begin the queue loop
         business check
         agent check
         play royalty-free (RF) music clip 1 (45 sec)
         play informational prompt 1 (15 sec)
         opt-out check
    go back to the queue loop
    2nd time through ..
         business check
         agent check
         play RF 2 (45 sec)
         play info 2 (15 sec
         opt-out check
    3rd time ...
         business check
         agent check
         play RF 3 (45 sec)
         play info 3 (6 sec)
         opt-out check
    4th time ...
         business check
         agent check
         play RF 4 (45 sec)
         play info 4 (6 sec)
         opt-out check
    And maybe one more time playing these types of prompts before we switch to placing the call on hold and playing CUCM MOH. Generally, most calls are answered before the five minute mark, however, we do have outliers who wait a very long time. Playing CUCM MOH might be the appropriate thing to do for those rare instances?
    I'm curious if anyone else has tried this and am hoping for some feedback?
    Thanks!
    Keith

    Hi
    There's nothing wrong with doing it that way. I've seen a few customers play music from prompts rather than holding; it's easier to maintain/change that way.
    Aaron

  • What is meant by Local Class and how we can create local classes in abap?

    Hi Friends
    what is meant by Local Class and how we can create local classes in abap?
    Regards,
    Sree

    Hi
    Local classes are the classes which we declare and use using the SE38 ABAP editor
    Global classes are the classes which we find in SE24 and call the methods of them into our program.
    see the sample code
    REPORT zs_class.
    SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS:p_var TYPE i,
    p_var1 TYPE i.
    SELECTION-SCREEN END OF BLOCK b1.
    CLASS d_class DEFINITION
    CLASS d_class DEFINITION.
    PUBLIC SECTION.
    METHODS:
    add,
    sub.
    PROTECTED SECTION.
    DATA : var2 TYPE i.
    ENDCLASS. "d_class DEFINITION
    CLASS d_class IMPLEMENTATION
    CLASS d_class IMPLEMENTATION.
    METHOD add.
    var2 = p_var + p_var1.
    WRITE:/ var2.
    ENDMETHOD. "add
    METHOD sub.
    var2 = p_var - p_var1.
    WRITE:/ var2.
    ENDMETHOD. "sub
    ENDCLASS. "d_class IMPLEMENTATION
    START-OF-SELECTION
    START-OF-SELECTION.
    DATA: obj TYPE REF TO d_class.
    CREATE OBJECT: obj .
    CALL METHOD: obj->add,
    Regards
    Anji

Maybe you are looking for

  • Hi where to specify in XI about the target system

    Hi! I have a j2EE application(servlet) that receives XML file from XI. Where should i specify in XI about this? Its urgent. Your help is greatly rewarded. Thanks

  • Iphoto Upgrade Questions

    does this mean my photos will be gone once upgraded? "Your photo library will not be readable by previous versions of iPhoto after the upgrade. The upgrade process for very large libraries may take an hour or more to complete"

  • Patching Oracle11G 11.1.0.6 to 11.1.0.7

    Hi. I have installed Oracle11g 11.1.0.6 to Linux SUSE 10. I patched it to 11.1.0.7. Now it looks like this SQL> select * from v$version; Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production PL/SQL Release 11.1.0.6.0 - Producti

  • Having trouble with chapters in iDVD

    To start off, I have searched the forums and haven't had luck finding the answer to this particular question, although I'm sure it's been asked before. I'm using FotoMagico to create slideshow movies of my vacations. I'd like to use iDVD to create on

  • Recovery Storage Groups removed from exhange 2010

    hi everyone, please let me know , how i can restore the single mailbox of user in exchange 2010 , as RSG is removed from Exchange 2010, how we can restore the database after the server failure or curruption in database, if you are not using DAG regar