Shared memory usage of Producer Consumer Problem

Hai,
I am able to write the Producer-Consumer problem as a interthread communication. But I don't know how to write it using shared memory. (i.e. I wish to start Producer and consumer as a different process). Please help me, sorry for the Temp file idea.
Thanks
MOHAN

I have read that in the new brightly JDK1.4 you would be able to use shared memory, but I have to confess that I'm not sure about if I'm mixing different informations (lots of stuff read, u know?). Try reviewing the JDK1.4 SE new features.
Also, I should reconsider using "traditional" ways like RMI, Sockets, and things like those.
Regards.

Similar Messages

  • Producer Consumer Problem using sockets

    Hello,
    Can anybody help me how to implement the Producer Consumer Problem using java sockets? Or any resources you've, pls forward it to me
    Cheers.

    Neg wrote:
    You just tell me if there is any means to do it.Yes, Just use a fixed length ArrayBlockingQueue on either end (or both ends) Use offer() to offer more data and this will return false when the queue is full.
    Note: the use of a Socket is entirely optional.

  • Processing acquired data (8 simultaneous channels) in RT host (producer,consumer problem)

    Hi Gents,
    I have a Crio 9024 and two delta sigma modules NI 9234, I have to acquire 8 cahnnels simultaneously at 51,2 kHz from FPGA and transfert this data via DMA fifo to the RT host for proceesing (FFT for all channels and send data to a host computer via a stream network). I succeed to do this with 25,6KHz as sampling frequency but when I tried with 51,2KHz (my goal) I had problem because in RT code I have a producer loop receiveing data from fpga (DMA fifo) and sending this data to a consumer (Queue) loop in RT also for processing this data but the producer is to fast so the consumer loop can't proccess data in time and the queue is overflow. I have replaced queues with RT fifo,single process variable,... but no luck !!!
    Any way how to send 8 channels data from one loop to other for processing (base band FFT N channels) at 51,2KHz ???
    Please I need help !!!

    DMA Fifo:
    To avoid overflow you have to configure the RT side which has a default size of 10000 (Rio4.0 and above 2^14 elements) or doubled FPGA depth (fifo_config)
    RT Fifo:
    config example
    Read data from DMA to RT Fifo
    (read all elements available and write this data block to your RT fifo, which is configured to hold n-Blocks of size x, i.e. 300Blocks of 18432elements each)
    --> here I suggest to read a multiple of 8, because of your channel count
    Read data from RT fifo to stream
    (send data blocks to the host where each block is one element in terms of streaming buffer --> configure streaming buffer)
    Configuring large RT Fifo's has an impact on memory usage, so have an eye on it.
    Screens are just examples (not functional code)
    Hope it helps
    Christian

  • Producer - Consumer problem

    Hi,
    Can anyone tell me what is the problem with the below program. Its following the traditional producer consumer concept. For the first time the producer is executed correctly , followed by the consumer printing the consumed value. But for the next time, its hanging at the producer wait loop.
    Thanks in advance,
    Cochu

    Hi All,
    I found out the problem. Actually I forgot to put the getShared() method in loop!!!
    Cochu

  • Producer/Consumer problem using jtux.

    The buffer can only have 10 items which contains 2 integers. But after some time the producer starts to produce and put more than 10 items in the buffer. Here the semaphore is suppose to stop it but it seems that the producer does not care about it and continues to produce items. I have gone through the code many times i cannot see what is wrong.
    //BOUNDED_BUFFER CLASS
    import java.io.*;
    import jtux.*;
    public class Bounded_buffer extends Semaphore{
         static public void main(String[] args) {
              long pid;
              int mutex = create(1);
              int fullBuffer = create(0);
              int emptyBuffer = create(10);
              int shmid = Shared_memory.create(84);
              long memPointer = Shared_memory.attach(shmid);
              Shared_memory.write(memPointer, intToByteArray(4), 4);
              int numProd = 5;
              int numCust = 10;
              try{
              for(int i = 0; i<numProd; i++) {
                   pid = UProcess.fork();
                   if(pid == 0) {
                        producer(mutex, fullBuffer, emptyBuffer, memPointer);
                        Shared_memory.detach(memPointer);
                        //Thread.sleep(500,0);
                        System.exit(0);
              for(int i = 0;     i<numCust; i++) {
                   pid = UProcess.fork();
                   if(pid == 0) {
                        customer(mutex, fullBuffer, emptyBuffer, memPointer);
                        Shared_memory.detach(memPointer);
                        //Thread.sleep(500,0);
                        System.exit(0);
              UExitStatus status = new UExitStatus();
              for(int i = 0; i<(numProd+numCust); i++)
                   UProcess.wait(status) ;
              }catch (Exception e) {
                   System.out.print("Exception: ");
                   System.out.println(">" + e.toString() + "<");
              } //try-catch
              destroy(mutex);
              destroy(emptyBuffer);
              destroy(fullBuffer);
              Shared_memory.detach(memPointer);
              Shared_memory.destroy(shmid);
              System.exit(0);
         } //end main
         static private void producer(int mutex, int fullBuffer, int emptyBuffer, long memPointer) throws Exception{
              long pid = UProcess.getpid();
              byte[] buffer = new byte[4];
              int usedBuffer;
              for(int i = 0; i<20; i++) {
                   wait(emptyBuffer);
                   wait(mutex);
                   //Thread.sleep((int)(10*Math.random()),0);
                   Shared_memory.read(memPointer, buffer, 4);
                   usedBuffer = byteArrayToInt(buffer);
                   Shared_memory.write(memPointer+usedBuffer, intToByteArray((int)pid), 4);
                   Shared_memory.write(memPointer+usedBuffer+4, intToByteArray(i), 4);
                   usedBuffer = usedBuffer + 8;
                   Shared_memory.write(memPointer, intToByteArray(usedBuffer), 4);
                   System.out.println("Item " + i +" produced by " + pid + '\t' + '\t' + "Items in buffer: " + (usedBuffer-4)/8);
                   signal(mutex);
                   signal(fullBuffer);
         static private void customer(int mutex, int fullBuffer, int emptyBuffer, long memPointer) throws Exception{
              long pid = UProcess.getpid();
              byte[] buffer = new byte[4];
              int usedBuffer, ppid, num;
              for(int i = 0; i<10; i++) {
                   wait(fullBuffer);
                   wait(mutex);
                   //Thread.sleep((int)(10*Math.random()),0);
                   Shared_memory.read(memPointer, buffer, 4);
                   usedBuffer = byteArrayToInt(buffer);
                   Shared_memory.read(memPointer+usedBuffer-4, buffer, 4);
                   num = byteArrayToInt(buffer);
                   Shared_memory.read(memPointer+usedBuffer-8, buffer, 4);
                   ppid = byteArrayToInt(buffer);
                   usedBuffer = usedBuffer - 8;
                   Shared_memory.write(memPointer, intToByteArray(usedBuffer), 4);
                   System.out.println("Customer " + pid + " got item " + num + " from " + ppid + '\t' + "Items in buffer: " + (usedBuffer-4)/8);
                   signal(mutex);
                   signal(emptyBuffer);
         private     static final byte[] intToByteArray(int value) {
              return new byte[] {
                   (byte)(value >>> 24),
                   (byte)(value >>> 16),
                   (byte)(value >>> 8),
                   (byte)value};
    // helper function to convert an array of 4 bytes to an int.
    // This function is needed to read ints from shared memory.
    private static final int byteArrayToInt(byte [] b) {
              return (b[0] << 24)
                   + ((b[1] & 0xFF) << 16)
                   + ((b[2] & 0xFF) << 8)
                   + (b[3] & 0xFF);
    //SEMAPHORE CLASS
    import java.io.*;
    // jtux is the library that gives the POSIX interface.
    import jtux.*;
    // This is an interface to the SystemV semaphores that are
    // easier to use. The SystemV interface to semaphores is
    // very weird and hard to understand. If you're interested
    // you can take a look here, but you do not need to understand
    // the implementation, just the interface.
    abstract class Semaphore {
    // Create a new semaphore. value should be its initial
    // value. It should be 1 in most cases. It returns a
    // handle to the semaphore.
    static int create(int value) {
         int semid = 0;
         try {
         semid = USysVIPC.semget(UConstant.IPC_PRIVATE,
                        1,
                        UConstant.IPC_CREAT | 00400 | 00200);
         USysVIPC.u_semun_int arg = new USysVIPC.u_semun_int();
         arg.val = value;
         USysVIPC.semctl(semid, 0, UConstant.SETVAL, arg);
         } catch (Exception e) {
         System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
         return semid;
    // Destroy a semaphore. This will free the semaphore given
    // as argument. You should always do this when you're finished
    // with a semaphore.
    static void destroy(int sem) {
         try {
         USysVIPC.u_semun semun = new USysVIPC.u_semun();
         USysVIPC.semctl(sem, 0, UConstant.IPC_RMID, semun);
         } catch (Exception e) {
         System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    // Operation P on a semaphore. Same operation as wait below. Use P
    // if you are familiar with the lectures, and wait if you are familiar with the course
    // book
    static void P(int sem) {
         USysVIPC.s_sembuf wait[] = new USysVIPC.s_sembuf[1];
         wait[0] = new USysVIPC.s_sembuf();
         wait[0].sem_num = 0;
         wait[0].sem_op = -1;
         wait[0].sem_flg = 010000;
         try {
         USysVIPC.semop(sem, wait, 1);
         } catch (Exception e) {
              System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    // Operation wait on a semaphore. Same operation as P above. Use P
    // if you are familiar with the lectures, and wait if you are familiar with the course
    // book
    // Wait for the semaphore. It will block until the semaphore
    // is available.
    static void wait(int sem) {
         USysVIPC.s_sembuf wait[] = new USysVIPC.s_sembuf[1];
         wait[0] = new USysVIPC.s_sembuf();
         wait[0].sem_num = 0;
         wait[0].sem_op = -1;
         wait[0].sem_flg = 010000;
         try {
         USysVIPC.semop(sem, wait, 1);
         } catch (Exception e) {
              System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    // Operation V on a semaphore. Same operation as signal below.
    // Use V if you are familiar with the lectures, and signal if you are familiar with the course
    // book
    static void V(int sem) {
         USysVIPC.s_sembuf signal[] = new USysVIPC.s_sembuf[1];
         signal[0] = new USysVIPC.s_sembuf();
         signal[0].sem_num = 0;
         signal[0].sem_op = 1;
         signal[0].sem_flg = 010000;
         try {
         USysVIPC.semop(sem, signal, 1);
         } catch (Exception e) {
              System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    // Operation siganal on a semaphore. Same operation as V above.
    // Use V if you are familiar with the lectures, and signal if you are familiar with the course
    // book
    static void signal(int sem) {
         USysVIPC.s_sembuf signal[] = new USysVIPC.s_sembuf[1];
         signal[0] = new USysVIPC.s_sembuf();
         signal[0].sem_num = 0;
         signal[0].sem_op = 1;
         signal[0].sem_flg = 010000;
         try {
         USysVIPC.semop(sem, signal, 1);
         } catch (Exception e) {
              System.out.print("Exception: ");
         System.out.println(">" + e.toString() + "<");
         System.exit(1);
    //SHARE_MEMORY CLASS
    import java.io.*;
    // jtux is the library that gives the POSIX interface.
    import jtux.*;
    // This is an interface to the SystemV shared memory that are
    // easier to use.
    // If you're interested you can take a look here, but you do not need to understand
    // the implementation, just the interface.
    abstract class Shared_memory {
         // create creates a new shared memory segment.
         // Argument size is the size of the segment in bytes.
         // create returns a handle to the newly created
         // shared memory segment. When the OS is not able to create a new
         // segment, the process is terminated with exit value 1.
         static int create(int size) {
    String keystring = new String(".");
         int shmid = -1 ;
    long key;
              try {
              key = USysVIPC.ftok(".", (int) UProcess.getpid());
              shmid = USysVIPC.shmget(key, size, UConstant.IPC_CREAT | 0666);
              } catch (Exception e) {
              System.out.print("Exception: ");
              System.out.println(">" + e.toString() + "<");
              System.exit(1);
         return(shmid);
         }//create
         // destroy removes the shared memory segment in argument.
         // If the argument shm is not a valid handle to a shared memory segment
         // the process is terminated with exit value 1.
         // You should always remove a shared memory segment when you are finished
         // with it.
         static void destroy(int shm) {
              try {
    USysVIPC.s_shmid_ds shmds = new USysVIPC.s_shmid_ds();
              USysVIPC.shmctl(shm, UConstant.IPC_RMID, shmds) ;
              } catch (Exception e) {
              System.out.print("Exception: ");
              System.out.println(">" + e.toString() + "<");
              System.exit(1);
         }//destroy
         // attach "places" the shared memory segment passed in argument
         // in the address space of the calling process. This way the process can
         // access the segment. A pointer to the the block in the process address space
         // is returned.
         // If the argument shm is not a valid handle to a shared memory segment
         // the process is terminated with exit value 1.
         static long attach(int shm) {
              long shmaddr = -1 ;
              try {
              shmaddr = USysVIPC.shmat(shm, 0, 0) ;
              } catch (Exception e) {
              System.out.print("Exception: ");
              System.out.println(">" + e.toString() + "<");
              System.exit(1);
         return(shmaddr) ;
         }//attach
         // detach "detaches" the shared memory segment at shmaddr
         // in the process's address space.
         // If there is no shared memory attached at address shmaddr.
         // the process is terminated with exit value 1.
         static void detach(long shmaddr)
              try {
              USysVIPC.shmdt(shmaddr);
              } catch (Exception e) {
              System.out.print("Exception: ");
              System.out.println(">" + e.toString() + "<");
              System.exit(1);
         }//detach
    // write : writes into shared memory segment.
    // writes at address addr datasize bytes of array data
    static void write(long addr, byte[] data, int datasize){
              UUtil.jaddr_to_seg(addr, data, datasize);
    }//write
         // read : reads from a shared memory segment.
    //reads datasize bytes at address addr and stores them in
    // array data
    static void read(long addr, byte[] data, int datasize){
              UUtil.jaddr_from_seg(addr, data, datasize);
    }//write
    }//Shared_memory

    What is jtux?
    Use code tags to make your post more legible.

  • Unsynchronized Producer Consumer Problem

    Hi I would like some help implementing an unsynchronized producer consumer with an unbounded queue (implemented using an ArrayList) I have both the producer and consumer sleeping for random amount of time (producer wakes up faster). The problem is that sometimes the producer never gives the consumer a chance to run.
    Note I have a notify after I add stuff to the ArrayList. I dont know whether its my choice of collection object or the fact that I have not defined a wait for the producer.
    I don't know whether I have explained my problem clearly so feel free to ask some questions. Thanks

    Maybe I should not have used the word unsynchronized.
    But what I am trying to do is have the producer
    putting more objects into the buffer than the
    consumer can remove. The problem is that my producer
    does not let the consumer run ever.The basic model is like this:
    // Producer
    while (!done()) {
      synchronized(queue) {
        while (queue.isFull()) {
          queue.notifyAll();
          queue.wait();
        queue.put(next job);
        queue.notifyAll():
    // Consmer
    while (!done()) {
      synchronized(queue) {
        while (queue.isEmpty()) {
          queue.notifyAll();
          queue.wait();
        job = queue.get();
        queue.notifyAll():
        process job
    }I expect I've missed a subtlety or two in the whole get/put/wait/notify cycle--I always have to reconstruct it from scratch in my head, it's not something I carry around. It should be pretty close though and should show you the main pieces.
    As mentioned, if you use the concurrency package, some of that gunk is hidden from you.

  • Shared memory usage

    hi group,
    I have a scenario that i have to use shared memory concept in routines of BI...here i have to write a abap code and check on a file. and i want to take that file from the shared memory concept. and then check. i also dont want to fetch th data from table but want to fetch this data also from some file using shared memory... i am totally new to shared memory concept and objects used there...can anyone guide me the step by step procedure for this...also if some help file available then that will be a great help...
    thanks in advance..

    A program which may help you is "ipcs". Specifically, "ipcs -am" run as root
    will give you information on all of the shared memory segments in use. The
    size of the segment is part of the data. This should give you a picture of
    what is going on in the system.
    Alan
    Sun Developer Technical Support
    http://www.sun.com/developers/support

  • Producer consumer problem - hanging

    Can anyone tell me how to fix this problem? In the code below the producer fills the queue until it reaches capacity (10) and then the consumer takes until it reaches 0 and then waits. It seems they are not running at the same time....I want the producer to be filling the queue each time the consumer takes.
    my output:
    Clerk ID: 1
    Clerk put: 1
    Clerk put: 2
    Clerk put: 3
    Clerk put: 4
    Clerk put: 5
    Clerk put: 6
    Clerk put: 7
    Clerk put: 8
    Clerk put: 9
    Clerk put: 10
    customer take9
    customer take8
    customer take7
    customer take6
    customer take5
    customer take4
    customer take3
    customer take2
    customer take1
    customer take0
    public class clerk extends Thread{
    //declare variables
    public ArrayBlockingQueue queue; //create "mailbox"
    public int number;
    /** Creates a new instance of clerk */
    public clerk(ArrayBlockingQueue q1, int num) {
    //System.out.println("Clerk created");
    queue = q1; //assign queue
    number = num; //assign number
    }//end clerk constructor
    public void run()
    long id = getId(); //get threads ID
    id = id - 6;
    System.out.println("Clerk ID: " + id); //test
    int t = queue.size(); //get size
    while(t < 10)//while the queue is not full
    try {
    queue.put(number); //add to queue
    t = queue.size(); //get size
    System.out.println("Clerk put: " + t); //test
    catch (InterruptedException e){ }
    }//end while
    //}//end for
    public class customer extends Thread {
    //declare variables
    public ArrayBlockingQueue queue; //create "mailbox"
    public int number;
    /** Creates a new instance of customer */
    public customer(ArrayBlockingQueue q1, int num) {
    queue = q1; //assign queue
    number = num; //assign number
    public void run()
    long id = getId(); //get threads ID
    id = id - 7;
    int t = queue.size(); //get size
    while(t > 0)//while there is something in the queue
    try {
    queue.take();
    int c = queue.size(); //get size
    System.out.println("customer take" + c);
    sleep((int)(Math.random() * 100));
    catch (InterruptedException e) { }
    }//end while
    //}//end for

    Your Clerk class is putting the items in the queue very rapidly (you have no sleep() call in there). Compare that to how you're throttling the Customer implementation. I'd expect Clerk to outrun it given that implementation.

  • Producer consumer problem - semaphores

    problem solved.
    Message was edited by:
    nasher

    The last one is 'E' a subnetmask for a private LAN of 20 machines
    Masking is at the bit level as in binary;-
    |||00000.||||||||.||||||||.|||||||| == 224.255.255.255 - mask ---> multicast
    ||000000.|0|0|0|0.||||||||.|||||||| == 192.168.255.255 - mask ---> Class 'C' Private LANS
    - or both, M-cast and Class 'C' Private LANS ;-
    ||||||||.||||||||.||||||||.|||||||| == 255.255.255.255 - which masks all IP addresses ie: all IP nos.
    - in a process called logical AND-ing ie:-
    0 + 0 = 0
    0 + | = 0
    | + 0 = 0
    | + | = |
    - So, to subnetMASK a private cls C LAN =
    ||||||||.||||||||.||||||||.||||0000 == 255.255.255.240
    - will leave 4 remaining bits to address the subnetwork and binary 0000|||| = (2 pow 4) 16, not enough! - though;-
    ||||||||.||||||||.||||||||.|||00000 == 255.255.255.224
    would = 5 bits = up to 32 (less 2, one=gtw + one=router) machines would've worked.Hope I've been of service, though I'm not 100% sure of the other answers.

  • Problem with Firefox and very heavy memory usage

    For several releases now, Firefox has been particularly heavy on memory usage. With its most recent version, with a single browser instance and only one tab, Firefox consumes more memory that any other application running on my Windows PC. The memory footprint grows significantly as I open additional tabs, getting to almost 1GB when there are 7 or 8 tabs open. This is as true with no extensions or pluggins, and with the usual set, (firebug, fire cookie, fireshot, XMarks). Right now, with 2 tabs, the memory is at 217,128K and climbing, CPU is between 0.2 and 1.5%.
    I have read dozens of threads providing "helpful" suggestions, and tried any that seem reasonable. But like most others who experience Firebug's memory problems, none address the issue.
    Firefox is an excellent tool for web developers, and I rely on it heavily, but have now resorted to using Chrome as the default and only open Firefox when I must, in order to test or debug a page.
    Is there no hope of resolving this problem? So far, from responses to other similar threads, the response has been to deny any responsibility and blame extensions and/or pluggins. This is not helpful and not accurate. Will Firefox accept ownership for this problem and try to address it properly, or must we continue to suffer for your failings?

    55%, it's still 1.6Gb....there shouldn't be a problem scanning something that it says will take up 300Mb, then actually only takes up 70Mb.
    And not wrong, it obviously isn't releasing the memory when other applications need it because it doesn't, I have to close PS before it will release it. Yes, it probably is supposed to release it, but it isn't.
    Thank you for your answer (even if it did appear to me to be a bit rude/shouty, perhaps something more polite than "Wrong!" next time) but I'm sitting at my computer, and I can see what is using how much memory and when, you can't.

  • Shared memory (System V-style) - High usage of phys memory and page outs

    Hi!
    I get a much higher usage of physical memory when I use shared memory than I would expect. Please, I would really need someone to confirm my conclusions, so that I can revise my ignorance in this subject.
    In my experiments I create a shared memory segment of 200 MB and I have 7 processes attaching to it. I have a ws of 1 GB.
    I expect to see what I see when I attach to the shared memory segment in terms of virtual size, i.e. SIZE in prstat. After attaching (mapping it) to the process all 7 processes are about ~203 MB each and this makes sense. RSS, in prstat, is about 3 MB for each process and this is ok to me too.
    It is what I see when each of the 7 processes start to write a simple string like 'Hello!' in parallel to each page in their shared memory segment that I get surprised. I run out of memory on my ws after a while and the system starts to wildly page out physical memory to disk so that the next 'Hello!' can be written to the next page in the shared memory segment. It seems that each page written to in the shared memory chunk is mapped into each process private address space. This means that the shared memory is not physically shared, just virtually shared. Is this correct?
    Can memory be physically shared, so that my 7 processes only use 200 MB? ISM? DISM?
    I create a shared memory segment in a C-program with the following calls:
    shmid = shmget(key, SHM_SIZE, 0644 | IPC_CREAT)
    data = shmat(shmid, (void *)0, 0);Thanks in advance
    /Sune

    Your problem seemed reasonable. What were you doing wrong?
    Darren

  • Problem with scanning and memory usage

    I'm running PS CS3 on Vista Home Premium, 1.86Ghz Intel core 2 processor, and 4GB RAM.
    I realise Vista only sees 3.3GB of this RAM, and I know Vista uses about 1GB all the time.
    Question:
    While running PS, and only PS, with no files open, I have 2GB of RAM, why will PS not let me scan a file that it says will take up 300Mb?
    200Mb is about the limit that it will let me scan, but even then, the actual end product ends up being less than 100Mb. (around 70mb in most cases)I'm using a Dell AIO A920, latest drivers etc, and PS is set to use all avaliable RAM.
    Not only will it not let me scan, once a file I've opened has used up "x" amount of RAM, even if I then close that file, "x" amount of RAM will STILL be unavaliable. This means if I scan something, I have to save it, close PS, then open it again before I can scan anything else.
    Surely this isn't normal. Or am I being stupid and missing something obvious?
    I've also monitored the memory usage during scanning using task manager and various other things, it hardly goes up at all, then shoots up to 70-80% once the 70ishMb file is loaded. Something is up because if that were true, I'd actually only have 1Gb of RAM, and running Vista would be nearly impossible.
    It's not a Vista thing either as I had this problem when I had XP. In fact it was worse then, I could hardly scan anything, had to be very low resolution.
    Thanks in advance for any help

    55%, it's still 1.6Gb....there shouldn't be a problem scanning something that it says will take up 300Mb, then actually only takes up 70Mb.
    And not wrong, it obviously isn't releasing the memory when other applications need it because it doesn't, I have to close PS before it will release it. Yes, it probably is supposed to release it, but it isn't.
    Thank you for your answer (even if it did appear to me to be a bit rude/shouty, perhaps something more polite than "Wrong!" next time) but I'm sitting at my computer, and I can see what is using how much memory and when, you can't.

  • Problem with JTree and memory usage

    I have problem with the JTree when memory usage is over the phisical memory( I have 512MB).
    I use JTree to display very large data about structure organization of big company. It is working fine until memory usage is over the phisical memory - then some of nodes are not visible.
    I hope somebody has an idea about this problem.

    55%, it's still 1.6Gb....there shouldn't be a problem scanning something that it says will take up 300Mb, then actually only takes up 70Mb.
    And not wrong, it obviously isn't releasing the memory when other applications need it because it doesn't, I have to close PS before it will release it. Yes, it probably is supposed to release it, but it isn't.
    Thank you for your answer (even if it did appear to me to be a bit rude/shouty, perhaps something more polite than "Wrong!" next time) but I'm sitting at my computer, and I can see what is using how much memory and when, you can't.

  • Having a problem with Excessive "modified" memory usage in Win7 x64, upwards of 3.6GB, any suggestions?

    I have 6GB of ram, a fresh install of Windows 7 x64, and the screenshot shows what happens after leaving my PC on for a couple days. (3782+MB being used by modified memory ATM).
    http://wow.deconstruct.me/images/ExcessiveMemory.jpg
    Any ideas on this?
    Edit:
    Added this after first round of suggestions
    http://wow.deconstruct.me/images/NotSoExcessiveMemory.jpg
    This is uptime of around 2 hours.
    The first image is of uptime of around 3-5 days.

    Matthew,
    The only reason why these pages are kept on the modified list indefinitely is because the system doesn't have any available pagefile space left. If you increase the size of the pagefile the system will write most of these pages to disk and then move them from the modified list to the standby list. Standby pages are considered part of "available memory", because they can be reused for some other purpose if necessary.
    Whether this would "fix" the problem or not depends on what the actual problem is. If it's an unbound memory leak then increasing the size of the pagefile will simply allow the system to run longer before it eventually hits the maximum pagefile size limit, or runs out of disk space. On the other hand, if it's a case of some application allocating a lot of memory and not using it for a long time, then increasing the pagefile might be a perfectly valid solution.
    Allowing the system to manage the size of the pagefile actually works well in most cases. Pagefile fragmentation (at the filesystem level) can only occur when the initially chosen size is not large enough and the system has to extend it at run time. For win7 we have telemetry data that shows that even for systems with 1 GB of RAM, less than 0.1% of all boot sessions end up having to extend the pagefile, and this number is even lower for larger amounts of RAM. If you think you are in that 0.1% and your pagefile might be getting fragmented, you can manually increase its minimum size such that the total system commit charge stays below 80% even if you run all your apps at once (80% is the threshold at which the pagefile is automatically extended). This will make sure the pagefile is created once and then stays at the same size forever, so it can't fragment. The maximum size can either be set to the same value as the minimum, or you can make it larger so that the system is more resilient to memory leaks or unexpectedly high loads.
    By the way, Windows doesn't use pagefiles as "extra memory", it uses them as a backing store for private pages, just like regular files are used as a backing store for EXEs/DLLs and memory mapped files. So if the system really has more than enough RAM (like in your second screenshot, where you have 3.6 GB of free pages) you shouldn't see any reads from the pagefile. You can verify this by going to the Disk tab in the resource monitor and looking for any disk IO from pagefile.sys. On smaller systems that don't have an excess of free pages you may see periodic reads from the pagefile, and this is expected because the total amount of data referenced by the OS/drivers/processes is larger than the total RAM. Forcefully keeping all pagefile-backed pages in memory (which is what disabling the pagefile does) would simply mean some other pages (memory mapped files, DLL code or data etc) would have to be paged out.
    Regarding further troubleshooting steps: If the system runs fine with a larger pagefile (commit charge stabilizes well below 80%, and you no longer see gigabytes of modified pages accumulating in memory) then you don't really need to do anything. If the problem persists, you can check for any processes with an abnormally high commit charge, and also check kernel memory usage in task manager. If it's a kernel leak you can usually narrow it down to a particular driver using poolmon.exe or kernel debugger.

  • Problem with memory usage and CPU usage

    Hello,
    i have a problem with the memory usage and cpu usage in my project!
    My application must run for more than 24 hrs. The problem is that the longer it runs the bigger is the memory and cpu usage!
    It starts with ~15% CPU usage and ~70 MBytes memory usage. After ~ 24hrs the CPU usage is ~60% and the memory usage is ~170 MBytes!
    After  3 days the CPU usage is almost about 70% and the memory usage is about 360 MBytes!
    What can I do to reduce this huge recource usage?
    Thank you!

    Hi Pahe,
       I think the issue is memory usage, since CPU usage can increase due to greater memory requirements.
       Anyway, it's difficult to debug without seeing your code, can you post it (possibly for LV 7.1 compatibility)?  Or just post a JPEG of the piece of code that can give problems...
       I guess you're appending data to an array instead of replace data elements, but I can't be sure...
       Have a nice day!
    graziano

Maybe you are looking for

  • BO XI 3.1 DeskI report Calculation mismatch

    Hi , I have an Calculation issue in one report after migrated from BO 5.1.6 to BO XI 3.1. After refreshing two reports parallelly, BO XI 3.1 report 1st 3 records of two columns are not at all there in BO 5.1.6 report. in XI 3.1 i am getting 3 more re

  • Sony BRAVIA network streaming

    Hello people, I am fairly new to the apple community and i am facing a problem. its been a whole week since i am trying to figure out how to stream video on my new bravia over the network. I ve even replaced my router last night. Equipment: Mac Pro -

  • How to select/unselect all checkbox in one column

    Hi Experts, I have a report with a column as check box. The query is like: select apex_item.checkbox(1, ID) "update", ID, name, job from a_table So that user can select the rows they want to update. Sometimes user wants to select all the rows. It's n

  • New User login with restart ?

    Hello, How to make a newly user created in WLS console or in the application log into the application without restarting the WLS or modification to weblogic.xml ? I have seen some message regarding this but did not find suitable answer ? Thanks Deepa

  • Cache Seeding ibot. Where is the button.

    Guys, I think I am blind. The checkbox is not there.......? I have done that ibot a million times now but..where is the checkbox now. Did I forget something? The user is admin in the repository.