How to allocate memory

How to force Java to allocate enough memory for a 20 Million character String.

Actually it would be:
StringBuffer b = new StringBuffer(20000000);Probably.
But if you have a few extra bytes of overflow I believe the algorithm doubles the space. Might be a bit much just for a couple of bytes.
Allocating a 2200000000 element array is a bit more difficult... any ideas?2 Billion?
Yes, one idea. Don't do it. It isn't possible. On any OS.
Windows and earlier versions of Sun had an addressable limit of 4 gig (billion). Using a 2 billion elements would mean each element could only occupy 2 bytes of space. And there won't be much room for the program to do anything else.
And that is addressable space. On windows an application can't use more than 2 gig, the OS reserves the other 2 gig. And a Sun box still has to have the OS components that the program needs in the addressable space.
I am guessing that you could do this on C/C++ using the 64 bit addressable space of Solaris 8.
However, every Sun JVM, at least before 1.4, always limits the max heap size to less than 4 gig. And a java object will take far more than 2 bytes of space.
It might just be possible on a Solaris box, but only if the elements are 'characters' and nothing else. Since Java uses a UTF8 format, if the characters are actually latin, then it will only take 2 gig. And I believe one can tweak the JVM up above that. But the box will have to have more than 2 gig of memory. At least if you expect the program to do processing without thrashing the harddrive.

Similar Messages

  • How to allocate memory dynamicall​y?

    Hello,
    I'm dealing with an array of fourteen (1024x8192 pix) images.
    Everything works correctly when the images are smaller,
    but when I use 1024x8192 ones for the calculations
    I run out of memory after 7th image.
    So is there a way for me to dynamically allocate memory size?
    So that IMAQ,arrays etc. do not keep allocating new space for
    data everytime.
    Labview memory raises up to 1 300 000K
    based on Windows Task Manager and crashes.
    I have 2GB memory on this machine.
    Best Regards,
    Ari

    No matter how much memory you have on the machine, you will never be able to use more than 1.5GBytes on a WindowsXP machine.  If you got 1.3GBytes, you did well, since the LV code must fit into that 1.5GBytes, as well.  The reason is that Windows is a 32 bit operating system and LabVIEW is a 32 bit executable.  It has an absolute maximum limit of 4GBytes.  Windows reserves the negative numbers for system code.  It also reserves the top 512MBytes of the positive 2GBytes for system DLLs.  That leaves everything else with 1.5GBytes.  Depending on your memory fragmentation and what other code is running, you will be able to use somewhat less than this.  So you probably need to rewrite to only load what you are actually using.
    For tips on dealing with large memory issues, check out Managing Large Data Sets in LabVIEW.
    Good luck.  Let us know if we can help more.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • How to allocate memory and to get the start address

    im just trying to allocate a memory of 8MB and to get the start address of that mem,  by getting the address i will access that memory by dll function..  so i want to know how to allocate the memory and to get the address.. any one knows then pls tell me

    duplicate post
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • How to allocate memory in Weblogic 8.0.1.5

    HI,
    Can anyone help me out with this one? Weblogic Server is slow and it always hang up. here is the details of the setup:
    OS: Windows 2000 Server
    Weblogic: BEA 8.0.1.5
    The physical memory of the server is 8GB but weblogic server is just using 1GB.
    I already tried changing the JAVA Heap to 2gb during the start up and yet it still uses 1GB.
    here is what I do:
    $ java -XX:NewSize=512m -XX:MaxNewSize= 2048m -XX:SurvivorRatio=8 -Xms512m -Xmx2048m
    Please let me know how can I allocate more memory for the Weblogic.
    thanks..

    Hi,
    The below link might help you :-
    http://renjan-thomas.blogspot.com/2009/08/java-virtual-machine-heap-size.html
    Edited by: user8650794 on Aug 18, 2009 5:08 AM

  • Best Practices Q - how to allocate memory to each instance

    We are moving to a system setup that will include multiple CF
    instances per machine, with the web server on an entirely separate
    machine (Distributed CF Mode). What is the current thinking on how
    much of the total RAM on a machine should be apportioned among the
    instances in CF on one machine in each JVM config?
    For example (and this is for the purposes of demonstration,
    not real world figures) if we have 1gigabyte of RAM on a machine
    with 3 instances running, do we devote two thirds of this (750
    megabytes) for all 3 instances in total, such that each instance
    gets 250 megs? Or does each instance get 750? My thinking is that
    if each had 750 there is the potential for a machine to be brought
    down?
    I came up with two thirds as I've been under the assumption
    that in a non-multi server setup this is the general rule of thumb.
    Appreciate any and all input,
    thanks

    If you allot more than the machine has physical memory, the
    OS will just put that information into swap space. If the load is
    high enough then the machine could come to a crawl.
    With only 1GB of memory, I wouldn't try to run more than one
    instance with 768MB as the high water mark. Maybe init the JVM at
    256MB.
    Knock the machine up to 4GB, then you could go with 3 512MB
    instances or 2 1GB instances.

  • How allocate memory by CIN

    Hi, i tried to use CIN for allocate memory to create a memory space by DSNewPtr function.
    This is my .c file:
    #include "extcode.h"
    MgErr CINRun(uInt32 Length, uInt32 *Address);
    MgErr CINRun(uInt32 Length, uInt32 *Address)
         Address = (uInt32 *)DSNewPtr(Length*(sizeof(uInt32)));
          return noErr;
    I want use the return for write into the memory allocate, but when i start run this CIN a error occurs:"not enough memory for complete this operation"(also with Length=1).I don't understand why.
    I use LabVIEW 8.0 and for compile the source file MIcrosoft Studio 2003.
    Can you please help me for this problem
    Sorry for my english

    CIN is like a SIN.
    So, avoid it as much as you can...
    - Partha
    LabVIEW - Wires that catch bugs!

  • Db_load error: Cannot allocate memory

    Hi
    when I try to import an dump file, i always get this error:
    db_load: BDB2055 Lock table is out of available lock entries
    db_load: Cannot allocate memory
    I executed "db_load -f outdb/outdb2 -h env xass.db"
    and i have set max locks by:
    dbenv->set_lk_max_locks(dbenv,1000);
    but it doesn't work.
    What should I do to prevent this problem?
    Thanks for your help in advance
    Mark
    Update:
    I have doing some tests, and i found that if I increase the number of locks by "set_lk_max_locks" in DB_CONFIG file,  the operation of db_load will success.
    The point is that the larger db file may need a very big value of locks, so why "db_load" doesn't release the locks during the running procedure? Is this a bug for bdb?
    becuase I can't increase the number of locks infinity!
    if not, How can i cause "db_load" release the locks of transaction?
    Does anybody can help me?
    Mark

    Hi Mark,
    If you are importing a dump file into an existing environment and opened with the flags of(can have more) DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN, then it is true you may see the error about "lock table is out of available lock entries" when the dump file is very big. The db_load process will not release the locks since it needs to provent other process from accessing the database being built to provide data consistency in the transactional environment.
    The usually way for loading a database from a dump file is to specify an empty directory as the home directory. By this, the database will be created in a private non-transactional environment, and you can copy the database into your running environment after the db_load process finishes.
    Regards,
    Winter, Oracle Berkeley DB.

  • Using Disc Utility to copy my hard drive to a brand new external drive and am having the error "Unable to create...(Cannot allocate memory)".

    I'm not very tech savvy but am trying my best to use Disc Utility to copy my hard drive to a brand new external drive and am having the error "Unable to create...(Cannot allocate memory)".
    Last night no problems, woke this morning and it was freezing so I forced a restart and got the grey screen with the folder and question mark. Ran off to best buy to get an external drive... Please help! Thank you!

    I have done both. When I hold down the "C" key it pauses for a few seconds while the cd spins and then the flashing folder icon appears.
    Could be you have the wrong cd/dvd.  The mac will only boot a supported cd/dvd for your machine. The flashing question mark indicdates your machine could not find a valid os.
    When I hold down the "option" key for the startup manager the cursor comes up and moves but the actually manager doesn't come up no matter how long I leave the laptop on.
    Not sure.  Could be your machine does not support the startup manager. You would think the machine would ignore the key.
    Where did you get the dvd?  What is the number on the DVD?
    What machine do you have anyway?
    This site provides more information, but lacks security.
    "A serial number is a unique, identifying number or group of numbers and letters assigned to an individual piece of hardware or software. It's used for various things depending on the product / brand but what is your Mac's serial number for and more importantly... what is it hiding and what can it do for you ?"
    http://www.appleserialnumberinfo.com/Desktop/index.php
    or
    This site provides more information, but lacks security too.
    "A serial number is a unique, identifying number or group of numbers and letters assigned to an individual piece of hardware or software. It's used for various things depending on the product / brand but what is your Mac's serial number for and more importantly... what is it hiding and what can it do for you ?"
    http://www.appleserialnumberinfo.com/Desktop/index.php
    http://www.chipmunk.nl/klantenservice/applemodel.html
        ( hint by K Shaffer  )

  • Oracle 8i listener issue:  TNS-01168: Cannot allocate memory

    We have a loader application coded in perl/c which connects to DB to load data from flat files. Whenever we have multiple such loader programs running, the listener dies and loading stops. The listener.log is around 2GB. I opened the loag and got following details:
    Listener Log file (2GB file):
    -- File begining ---
    ECHO is on.
    17-FEB-2005 20:40:20 * service_update * scanview * 0
    17-FEB-2005 20:50:20 * service_update * scanview * 0
    17-FEB-2005 21:00:10 * (CONNECT_DATA=(SERVICE_NAME=scanview)(CID=(PROGRAM=C:\Perl\bin\perl.exe)(HOST=AZSACTAPP107)(USER=grp_scanview))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.2.164.17)(PORT=2659)) * establish * scanview * 0
    19-FEB-2005 03:14:26 * service_update * scanview * 0
    19-FEB-2005 04:00:09 * (CONNECT_DATA=(SERVICE_NAME=scanview)(CID=(PROGRAM=C:\Perl\bin\perl.exe)(HOST=AZSACTAPP107)(USER=grp_scanview))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.2.164.17)(PORT=2486)) * establish * scanview * 0
    19-FEB-2005 04:04:27 * service_update * scanview * 0
    19-FEB-2005 04:07:07 * (CONNECT_DATA=(SERVICE_NAME=scanview)(CID=(PROGRAM=C:\Perl\bin\perl.exe)(HOST=AZSACTAPP107)(USER=grp_scanview))) * (ADDRESS=(PROTOCOL=tcp)(HOST=10.2.164.17)(PORT=2644)) * establish * scanview * 0
    19-FEB-2005 04:18:21 * 51
    Error Started at Line #: 2096
    19-FEB-2005 04:18:21 * 51
    NL-00051: internal error code, arguments: [302], [1], [], [], [], [], []
    Above error continued till Line #: 913372
    19-FEB-2005 04:21:15 * 1168
    TNS-01168: Cannot allocate memory
    19-FEB-2005 06:05:30 * 1168
    TNS-01168: Cannot allocate memory
    TNSLSNR for 32-bit Windows: Version 8.1.7.4.0 - Production on 19-FEB-2005 11:13:49
    -- File ended ---
    Is there a known bug and if so what is the resolution? Will upgrading to Net 9i help?
    Let me know if anyone has faced such issue and the resolution.
    Thanks
    Satish

    alll listeners show the TNS-12531 cannot allocate memory message in the listener.log.Only a single listener is required.
    How many listeners run on this system & why more than 1?
    oerr tns 12531
    12531, 00000, "TNS:cannot allocate memory"
    // *Cause:  Sufficient memory could not be allocated to perform the desired
    // activity.
    // *Action:  Either free some resource for TNS, or add more memory to the
    // machine. For further details, turn on tracing and reexecute the operation.

  • My internal drive is NOT showing up in the event library in Final Cut X.  I am also getting a "The operation couldn't be completed. Cannot allocate memory" Any ideas? I am using an IMAC Core i7 with 8GB memory, OS version 10.6.8

    My internal boot drive is NOT showing up in the Event Library in Final Cut X. My external raid drive is showing up.
    I am also getting error message "The operation couldn’t be completed. Cannot allocate memory"  when attempting to create a new "event".   Any ideas?
    If I had a application disk, I would unistall and reinstall FCPX.  I am assuming there is a way do do this without a disk - just have not been able to easliy find out how.
    I am using an IMAC Core i7 with 8GB memory, OS version 10.6.8
    Thanks

    Well it did NOT work.  Here is a screen capture as FCPX loads showing the drive while it loads. Then when it is loaded, NO drive showing up in the Event Library ( I have turned off the external drive).
    ANY ideas . . . .  Anybody . . . .  APPLE?

  • 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

  • Safari - POSIX error 12 - cannot allocate memory

    I am trying to use my ipod touch for the internet. When I try to go to a site I get the following error.
    Safari can't open the page.
    The error was: "Operation could not be com0pleted.
    (POSIX error 12 - Cannot allocate memory)"
    (NSPOSIXErrorDomain:12)
    How do I get past this error

    If you haven't already done so, I'd suggest rebooting your iPod. This isn't the same as turning it off with a quick tap to the button on top. Quite often a reboot of a computer will clear up a temporary memory issue. From the ipod touch manual:
    Press and hold the
    Sleep/Wake button on top of iPod touch for a few seconds until a red slider appears,
    then drag the slider. Then press and hold the Sleep/Wake button until the Apple logo
    appears.
    Hope this solves it and you don't see the error again.

  • POSIX Error 12 - cannot allocate memory

    Hi
    I am having trouble to connect the iPod Touch to my home network, I can see that it recognize my netzork but when I try Safari I got the error 'Safari can't open the page, The error was "Operation could not be completed (POSIX error 12 - cannot allocate memory) (NSPOSIXErrorDomain:12)
    I wonder if the network is recognized through Safari.
    Do you know where to find the list or errors and correction?
    How do you know on Safari if you are connected to the network ?
    On my settings I got an IP address and all the parameters.
    Thanks for your help

    If you haven't already done so, I'd suggest rebooting your iPod. This isn't the same as turning it off with a quick tap to the button on top. Quite often a reboot of a computer will clear up a temporary memory issue. From the ipod touch manual:
    Press and hold the
    Sleep/Wake button on top of iPod touch for a few seconds until a red slider appears,
    then drag the slider. Then press and hold the Sleep/Wake button until the Apple logo
    appears.
    Hope this solves it and you don't see the error again.

  • POSIX Error "cannot allocate memory"

    Hi
    When I try to run an update or open Itunes I get a note appearing saying "POSIX Error "cannot allocate memory"....
    I have looked in these forums and tried to ring Apple with no luck, I am also reasonably computer illiterate.
    The only thing that has been done differently is that a friend connected his Iphone to get music
    Does anyone know how to rectify this?
    Regards Simon

    Usually this specifies a networking problem.
    A solution one user found on another forum was to set his modem to bridge mode and turn off automatic proxy. I don't know if that will work for you but I don't think it would hurt to try.
    (The original thread is here: http://forums.macosxhints.com/archive/index.php/t-65149.html)

Maybe you are looking for

  • How to use one structure in different reports

    Hi All, We have created two reports on the same multi provider. Created one structure with more than 50 key figures and used the option save as, provided technical name for that structure. I want to use the same structure in second report too.But whe

  • Control & Simulation Loop failed to compile

    Dear Forum Members, I have a problem with a Control & Simulation Loop program (attached) that just doesn't compile & run.  I believe that the problem is associated with the 'Feedback Node' at the bottom of this Control & Simulation Frame since if thi

  • Portal Content Objects Hierarchy

    Hi What is the Objects Hierarchy in Portal Content. RoleWork setPageIview Any help document available explaining functionality of  Work set, Page, Iview Thanks

  • Not able to sync Exchange Server :-(

    Hello all, I am having trouble while setting up exchange account. Need help, i am getting no where. Here's where I am stucked... 1.Details entered Email: [email protected] UserName : [email protected] Password : *** Description : [email protected] 2.

  • Head Tracking in After Effects CC?

    Hello, i want to track a whole head in after effects i guess it works with mocha. And finally i want to have plane of the whole head like a mesh, so that i can add textures and adjustments. Does anybody know how it could work?