How can I allocate memory at runtime?

Hi,
I have declared a an array of objects like.
private SampeObject [] channelAccounts = null;
How can I allocate the memory at runtime(dynamically) ? I tried with
channelAccounts = new SObject(); But its giving runtime null pointer exception.
Can anyone tell me how can I allocate the memory.
Thanks,
Chinnionline

public class ArrayAlloExample
    public void buildArray()
        // Determine how many you want
        int howMany = 12 ;
        // Declare the array to be the size its supposed to be
        SampleObject[] sObjList = new SampleObject[howMany] ;
        // Spin through the array and load it with new objects
        for(int i=0; i<howMany; i++)
            sObjList[i] = new SampleObject() ;
class SampleObject
    private String stuff ;
    public SampleObject()
        super() ;
        doStuff() ;
    public void doStuff()
        stuff = "Put some really spiffy stuff here" ;
}This is an example of how to load an array of objects. That said, there are MUCH better ways of dealing with collections of things than with arrays.
Arrays are handy when you know how many of something you're going to have. If you don't, then I'd reccomend an ArrayList or something similar.
Hope this helps,
PS.

Similar Messages

  • How can VDC allocate cpu and memory resources?

    Hi,
       I know VDC on nexus 7k can allocate interface ,fib acl tcam resources,
      but how can vdc allocate memory and cpu resouces an sup2/sup2e and i/o module!
       for example.
       vdc  1 get at least 20% cpu , and he can reache beyond 20% cpu  if cpu ultilization is low. but if system is busy , he just can get 20
    % cpu resouces. I know cpu resources is difficult to config like this.
       or memory , can one vdc limit to 20% memory.
       thank you!
    tom

    Hi,
    in this documents do you have a way to make something that you want.
    http://d2zmdbbm9feqrf.cloudfront.net/2012/usa/pdf/BRKDCT-2121.pdf
    Thanks.

  • How can I create a Forms9i Runtime for client distribution

    Currently we have an application developed in Forms 5.0.6.8.0 our Database has been upgraded to 9i DB. The application is working fine with this combination but we want to upgrade Forms in order to get Oracle Support. We just get the Developer Suite 9i package and we're trying to test our application with this software.
    How can I create the client runtime for Forms 9i?
    My application will work with Win 95 and 98?
    Thanks.

    Oracle9i Forms is web-only. Forms 6i is the last release of Forms to have client/server and character mode.
    You can test Forms from the Builder by installing iDS. To deploy Forms using iAS follow the documentation. It's all there in the deployment guide.
    iAS and Forms doco can be found on OTN.
    Regards,
    Robin Zimmermann
    Forms Product Management

  • Error while creating Move-In - How can i Allocate Device to Installation ?

    Hello Experts,
    while creating Move-In i am getting following Error "No Devices Allocated to Installation PC0301A0 on 10.03.2011"
    How can i allocate device to installation, please advise where can i configure the settings and create Move-In without above error.
    Regards,
    Rajesh. G

    Hi Bill,
    Thanks for your responce it was helpfull, but i am trying to create Move-In with help of Contract Account. I was not able to create Move-In and i tried even with Bussiness Partner.
    When i was trying to create Move-In with the help of Business Partner Option in Move-In i am getting error as "The required index has not been created yet in the search Engine", same is happening when i am trying for Business Partner in Business Master Data. This might be the reason for Move-In creation Error, please help me where can i configure index settings for search engine for Business Partner.
    Please correct me if i am wrong.
    Thanks,
    Rajesh Gunda

  • In my server RMAN can't allocate memory to the virtual instance

    Hi
    I want to restore my database in a new server
    At first I want to restore "spfile" from controlfile autobackup, there is no spfile or pfile of my database in the new server
    I do these steps
    1 . expoer ORACLE_SID=Sales
    2. rman target /
    3. rman > set dbid 817528985
    4. rman > startup force nomount
    after step 4 I get this error :
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of startup command at 09/22/2010 14:03:21
    RMAN-04014: startup failed: ORA-04031: unable to allocate 28704 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","kebm test replies")
    I get this error while I have about *80GB* free memory on the new server
    and my parameters in /etc/sysctl.conf file is :
    kernel.sysrq = 0
    kernel.core_uses_pid = 1
    kernel.shmall = 5242880
    kernel.shmmax = 42949672960
    kernel.shmmni = 4096
    kernel.sem = 250 32000 100 128
    fs.file-max = 65536
    net.ipv4.ip_local_port_range = 1024 65000
    net.core.rmem_default = 1048576
    net.core.rmem_max = 1048576
    net.core.wmem_default = 262144
    net.core.wmem_max = 262144
    I need to say that I can create a new database in that server by dbca that its
    sga_max_size is 9632M and pga_aggregate_target is 3206M
    Do you know what is wrong ? Do you know why RMAN can't allocate memory to the virtual instance ?
    thanks

    The database which could not start is because of the low memory on the system or in the sga_max_size there is high value set. So the system could not allocate so large memory as it does not have free so much. There may be other reasons like OS limitation in order of usage the memory.
    Set a lower amount of memory in the database.
    Eg:
    SQL> alter system set sga_max_size=1600M scope=spfile;
    System altered.
    SQL> alter system set sga_target=1600M;
    System altered.
    refer the link it will be useful:http://arjudba.blogspot.com/2008/05/startup-fails-with-ora-27102-out-of.html
    else use manually copy the spfile/pfile to the new server
    refer the link, it may be useful to you.http://oracleinstance.blogspot.com/2010/08/disaster-recovery-using-rman-demo.html
    Edited by: rajeysh on Sep 22, 2010 4:40 PM

  • How can we free memory?

    how can we free memory? what do "alter system flush shared_pool" and "alter system flush buffer_cache" commands do?

    If you want to reduce the size of the SGA, you could reduce initialization parameters that are taken into account to size the SGA: see the the Concepts Guide.
    The statements that you have mentionned do no reduce the size of the SGA allocated at OS level but only flush or empty the related caches.

  • How can I reclaim memory/storage so I can burn a DVD with iDVD?

    How can I reclaim memory/storage so I can burn a DVD with iDVD?

    Move your iPhoto Library and/or your iTunes library to and external HD that is formatted OS X Extended (journaled) and run them from there. Be sure to try the libraries on the EHD before you delete them from the boot drive.
    This should easily free up the 25 GB minimum needed for iDVD to create and burn video DVD efficiently.
    Follow this workflow to help assure the best qualty video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process.
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.

  • How Can I Clean Memory, Cache...An​d Boost Memory On Playbook (like clean & boost memory on Blackberry phone)?

    Dear bros, I have a question which I concern about: How Can I Clean Memory, Cache...And Boost Memory On Playbook (like clean & boost memory on Blackberry phone)? I want to to this because I want my playbook run smoothly.
    Thanks all.

    The PlayBook manages memory through the OS, there's no 'memory cleaner' like on the BlackBerry phones.
    In the browser, there are settings to clear cache, cookies and history which do improve the browser performance.
    You may want to try and change the PlayBook multitasking mode. Go into Settings - General and change 'Application Behaviour'. Showcase is full multitasking (slower), Paused pauses all programs when minimised and makes the PlayBook save battery and run a little faster.
    Hope that helps.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!

  • How can i add memory to my mid 2007 IMAC

    how can i add memory to my IMAC

    You can have up to 6GB of memory for that model.
    Many people on these forums speak well of the following memory suppliers.
    In North America contact OWC …        Upgrade Apple iMac Memory
    In Europe contact Crucial.com  …       RAM Memory Upgrade
    Both companies have facilities to guide you and will recommend the correct memory package to meet whatever needs you describe to them.  
    There may be benefits buying from whichever company has a branch in your own geographical location insofar as Shipping charges, Local sales taxes and Exchange rates.  Check out the basic memory costs and do your sums.
    Guide to required RAM.    Lookup Mac Specs By Serial Number, Order, Model & EMC Number, Model ID @ EveryMac.com

  • My ipad says can not allocate memory when trying to log on the net

    After loading music on my ipad2 I can not log on to the web. It says cannot open the page. The error was: "The operation couldn't be completed. Cannot allocate memory". Does anyone know how to fix this issue?

    Close all Inactive Apps
    1. Double-click the Home button to see all Inactive Apps
    2. Hold the Apps down for a second or two until you see the minus sign
    3. Tap the minus sign to close App
    4. Reset iPad. Hold the Sleep and Home button down for about 10 second until you see the Apple logo

  • Smbnetfs manual mount shares returns 'can't allocate memory'

    So I have Samba running on my linux computer so that I could access the files on it from my other windows computer.  This is all fine and dandy and works.  Now when I have another computer thats on Linux and I'm trying to connect to the host machine with
    sudo mount -t cifs //192.168.0.142/IPC$ /mnt/networkshare/ -o user=siegemachine,password=xxxx,workgroup=HOME,ip=192.168.0.142
    I get
    mount error(12): Cannot allocate memory
    Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
    The only thing I've found by searching is that if the host is a windows file that you can change the packet size or something within the registry but since its being hosted by a linux computer... I'm not exactly sure what I should check first.
    Also, when I cd into the smbnetfs folder in /mnt/smbnet I can see my workgroup (HOME) and when I go into that I see the hostname of my linux computer upstairs.  Now, going into that directory and typing ls reveals nothing though.

    You've never said what version of Win you're using; however, if it's Win 7 then you'll have to hack the registry and/or the local security policy settings. There are various tutorials on the net to learn how to do this.  If you are on Win 7 I strongly suggest you google for
    "windows 7" +samba

  • Can't allocate memory

    Hello,
    I have an question that not really concerne OWB but rather Oracle (adminstration).
    This is an error that occurs after running a mapping (in mode SETBASED) that make a insert into a table of a lot of record an also make a lot of calculations for each records.
    The solution is to turn the operating mode to ROWBASED and there is no more problem.
    That cause the ORA-04030 error : out of process memory when trying to allocate 61464 bytes (koh-kghu sessi,peidxblds:num)
    OK, so i remeber that I must change the operating mode, but when a set ROWBASED and a re-run the mapping, this error is still there and i can only run the mapping without problems after one day (+-).
    My question is, why ORACLE will not run this mapping immediatly, how can I do to liberate the memory for this mapping?
    Remember ORACLE also the name of the mapping? So that when a run the mapping it see that there was already a problem with it and say STOP?
    Thanks you,
    Sébastien.

    ORA-04030 out of process memory when trying to allocate string bytes (string,string)
    Cause: Operating system process private memory has been exhausted.
    Action: See the database administrator or operating system administrator to increase process memory quota. There may be a bug in the application that causes excessive allocations of process memory space.
    So this means that you should start of with reviewing the process memory allocated and if possible increase this.
    Jean-Pierre

  • How can I measure memory allocation of a Java Application?

    We built a web application that enables images to be loaded into a database through a servlet running on Tomcat. We have inconsistent behaivor when more than x number of people are loading images simultaneously. No doubt a memory allocation problem, but how can I measure it?
    For example, I'd like to be able to create a graph showing the resources used against the number of people making uploads. I am using Linux and Tomcat/Apache.
    I am hoping for something like Memory counters that are available for measurine Windows applications on MS Windows - comes with the Resource Kit. Does this type of tool exist for the Java/Linux market?

    It is difficult to gauge memory usage from a Java application as the JVM handles garbage collection and even if objects are not referenced they might still be sitting in memory until the next garbage collect.
    Anyhow, a way to query available memory is:
    Runtime.getRuntime().freeMemory()
    You can run this at the begining of a process and at the end and examine the difference. You should call System.gc() before each freeMemory() call in order to try to force garbage collection.
    Another method would be to turn to the underlying OS. On linux you could use 'top' or 'ps'. With ps you could do something like:
    ps -o rss,vsz,%mem <pid>
    Where <pid> is the parent Tomcat process' id. The resulting three columns are:
    - Amount of real memory used.
    - Amount of virtual memory used.
    - Percentage of real memory used.
    'man ps' wil give you more options on how to use ps.
    There are also fancy graphical stuff like 'gtop' as well.
    Hope this helps.

  • How can I solve memory lick, which occurs when operate Oracle 10g DB ?

    I'm using Dell power Edge2850 server(dual CPU, 4GB Ram), RedHat AS 3 and Oracle 10g SE ONE. When I started the server, transaction speed was very fast. But after several day, the system has been getting slower seriously.
    So I monitored my system using 'top'. And I've found that almost 30MB swap memory has been used and CPU usage has been only 23%. But there has been 2GB idle Ram memory. Besides when Oracle don't execute any operation, swap memory is not freed. After I started my server, swap memory allocated has been getting larger and larger. And the speed of my system has been getting slower and slower.
    I think that it is very strange thing not to free swap memory when there is no operation on the server.
    Of course, swapping which rise with large transaction is not problem. But it is a serious problem not to free swap memory when there is no transaction.
    How can I solve this ploblem? Thanks.

    This means the the URL for database control will use the http protocol. To convert to the https protocol (using the included SSL certificate), use the steps documented above. Before doing so, pl review MOS Doc 1222603.1
    HTH
    Srini

  • How can we assign BS at runtime ?

    Hi
    How can we assign Buisness systems at runtime ?
    Ajith

    Hi Ajith
    Assigning the business system at runtime is possible using conditional receiver determination
    Importing in ID at runtime i dont think so. You have to import it at design time. Right click and assign business system this will allow you to choose from SLD components
    Check SLD
    http://help.sap.com/saphelp_nw04/helpdata/en/fe/39ae3d47afd652e10000000a114084/frameset.htm
    Thanks
    Gaurav

Maybe you are looking for