Degree in Dynamic memory allocation need help!

I'm a student in the University of Bucharest in Computer-Science in the senior year. I'm looking for some specs for my degree in Dynamic memory allocation. In particular I was looking for specs about how the JVM heap and garbage collector work. Can you please direct me to someone how can help me find the necessary specs?
Thank you.

[http://java.sun.com/javase/technologies/hotspot/]
~

Similar Messages

  • Problem in dynamic memory allocation

    Hi,
    My name is Ravi Kumar. I'm working on a project to improve organizational performance which include visual studio for simulation. I'm using dynamic memory allocation to allocate space for the array that are used in the program. Now I have run-time error
    which I can't understand where it is going wrong. Can someone please help me regrading this issue. 
    If anyone interested in helping please leave a comment with your email id so that I will share the whole project folder.
    Thanks,
    Ravi

    Hi Ravi,
    Don is right that this is the forum to discuss questions and feedback for Microsoft Office client.
    Please post in MSDN forum of Visual Studio, where you can get more experienced responses:
    https://social.msdn.microsoft.com/Forums/en-US/home?forum=visualstudiogeneral
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Queue of arrays without dynamic memory allocation

    Hey folks,
    I'm working on optimizing a timing critical VI. This VI is the
    producer in a producer consumer architecture. I'm trying to populate
    a queue from file in a manner that is as efficient as possible. My
    current plan of attack is:
    - read block of data from file and populate array (pre-allocated).
    - add array (always of the same size) to Queue with a max size defined
    (e.g. 50 elements)
    - This is in a while loop as is the standard producer consumer model.
    To improve the performance I would like to ensure that there is no
    dynamic memory allocation on the Queue's behalf. This is easily done,
    from what I understand, if the data type in the queue is of the same
    type (e.g. double, int). However, since the size of an array can vary
    does this mean that any queue of arrays will always dynamically
    allocate memory? Is there a way to ensure that the queue will always
    use the same memory as in a circular queue?
    Thanks,
    Steve

    Duplicate.
    Try to take over the world!

  • Templates and Dynamic Memory Allocation Templates

    Hi , I was reading a detailed article about templates and I came across the following paragraph
    template<class T, size_t N>
    class Stack
    T data[N]; // Fixed capacity is N
    size_t count;
    public:
    void push(const T& t);
    };"You must provide a compile-time constant value for the parameter N when you request an instance of this template, such as *Stack<int, 100> myFixedStack;*
    Because the value of N is known at compile time, the underlying array (data) can be placed on the run time stack instead of on the free store.
    This can improve runtime performance by avoiding the overhead associated with dynamic memory allocation.
    Now in the above paragraph what does
    "This can improve runtime performance by avoiding the overhead associated with dynamic memory allocation." mean ?? What does template over head mean ??
    I am a bit puzzled and i would really appreciate it if some one could explain to me what this sentence means thanks...

    The run-time memory model of a C or C++ program consists of statically allocated data, automatically allocated data, and dynamically allocated data.
    Data objects (e.g. variables) declared at namespace scope (which includes global scope) are statically allocated. Data objects local to a function that are declared static are also statically allocated. Static allocation means the storage for the data is available when the program is loaded, even before it begins to run. The data remains allocated until after the program exits.
    Data objects local to a function that are not declared static are automatically allocated when the function starts to run. Example:
    int foo() { int i; ... } Variable i does not exist until function foo begins to run, at which time space for it appears automatically. Each new invocation of foo gets its own location for i independent of other invocations of foo. Automatic allocation is usually referred to as stack allocation, since that is the usual implementation method: an area of storage that works like a stack, referenced by a dedicated machine register. Allocating the automatic data consists of adding (or subtracting) a value to the stack register. Popping the stack involves only subtracting (or adding) a value to the stack register. When the function exits, the stack is popped, releasing storage for all its automatic data.
    Dynamically allocated storage is acquired by an explicit use of a new-expression, or a call to an allocation function like malloc(). Example:
    int* ip = new int[100]; // allocate space for 100 integers
    double* id = (double*)malloc(100*sizeof(double)); // allocate space for 100 doublesDynamic storage is not released until you release it explicitly via a delete-expression or a call to free(). Managing the "heap", the area from where dynamic storage is acquired, and to which it is released, can be quite time-consuming.
    Your example of a Stack class (not to be confused with the program stack that is part of the C or C++ implementation) uses a fixed-size (that is, fixed at the point of template instance creation) automatically-allocated array to act as a stack data type. It has the advantage of taking zero time to allocate and release the space for the array. It has the disadvantages of any fixed-size array: it can waste space, or result in a program failure when you try to put N+1 objects into it, and it cannot be re-sized once created.

  • Crash the dynamic memory allocation

    hi
    i am new to java, my prof said to crash the java prog. write simple prog. which allocate dynamic memory in C++ and Java. push the limits to see how much allocation cause the programs to crash.
    how do i implement this in java.. can any one help out here.
    thanks in advances.

    Write a program that allocates larger and larger objects until it crashes. Make sure it prints the sizes of the objects as it runs.

  • Dynamic memory allocation on HP-UX for multiple instances on one host

    Hi everyone,
    I was wondering what the current possibilities are nowadays on running multiple SAP instances on one very large host with regard to resource sharing. Normally, for each instance, using PHYS_MEMSIZE etc you have to set the memory to a fixed size and then optimize it.
    Preferrably we would like the memory to be allocated based upon actual usage. Is that possible at all? on HP-UX? Using third party techniques?
    Thank you
    Marcel Rabe

    Hello Marcel,
    As Juan said you may not be able to change the parameters at runtime.
    The only parameters that can be dynamically switched are :
    ztta/roll_first
    ztta/roll_extension
    ztta/roll_area
    abap/heap_area_dia
    abap/heap_area_nondia
    abap/heap_area_total
    em/stat_log_size_MB
    em/stat_log_timeout
    These parameters would put a cap on memory allocations, however they wouldn't help increase the total addressable memory area.
    I would suggest that you consider Adaptive Computing for dynamic use of resources.
    Adaptive Computing
    Regards,
    Siddhesh

  • Dynamic memory allocation failure

    Dear reader,
    We sometimes have a problem where our windows 2012 r2 RDS virtual servers, that reside on windows 2012r2 hyper-v hosts, loose their dynamic memory and only have their startup memory left to work with. Users start complaining that things are very slow etc.
    If I check several screens (RDS Broker load balancing, hyper-v manager, cluster manager and the vm's task manager) it's clear that the vm only has its startup memory allocated. I'm not sure if this happens instantly or immidiatly after the nightly reboot.
    To resolve the problem we have to call all users on the vm where it happens and ask them to logoff (if they are even able to), and then we reboot the machine.
    I have checked the logs from the machine where the VM resides on and the logs from the vm itself. But I cannot find anything. We also have alot of windows 2008r2 vm's with dynamivc memory, but none of those have ever had this problem.
    Searched the internet, but so far it seems we are only.
    Can anyone give me a lead to troubleshoot this?
    Best regards,
    Ruud Boersma
    MCITP Enterprise administrator

    Hi all,
    I'm going to be "one of those people" who revives dead posts for something that is relevant but obviously not fixed... sorry in advance!
    We have the exact same situation, a bunch of RDSH guests with Dynamic memory turned on (60+ of them). every day between 1-8 of them will fail to allocate Dynamic memory and will be stuck on their startup RAM amount. This really hurts our users at peak
    times.
    I have engaged our TAM and have raised a case with PSS, Usual story "your the only one with this problem". Which obviously isn't true.
    So, we have tons of free RAM on the hosts, 600GB+ on most of them, the issue affects RDSH hosts at random, across multiple hosts and clusters.
    The screen shots attached are of one of our hosts from this morning. it has 8GB startup, 8GB minimum, 32GB Maximum RAM configured, with a 23% buffer. the host has 752GB RAM FREE. Notice how the perf counter "Hyper-V Dynamic Memory Integration Service"
    is reporting "0", it should be reporting "32768". also under task manager on the VM we are missing "Maximum memory" which should be just below "Hardware reserved" in the bottom right hand corner.
    Looks like the balloon driver is being delayed at boot time, we are going to XPerf all the servers in the hope that we can catch the critter. It's an unusual problem.
    We only have Acrobat PDF viewer, word viewer, excel viewer and two custom dot.NET applications installed on the guests. Some of the servers are also just dumb RDSH hosts, with not connection broker configured, using an F5 loadbalancer for load distribution
    and session management. All guests are 2012R2 patched up to March 2015, integration Services are installed and up to date (its an enlightened OS remember).

  • Dynamic Client Exception - Need help

    Hi,
    Need help.......
    I am getting following exception, when I run
    my dynamic client.
    Attached below is my code as well as WSDL.
    Thanks in advance..
    Regards
    -Shakeel
    [java] javax.xml.rpc.JAXRPCException: failed to invoke operation 'Print' du
    e to an error in the soap layer (SAAJ); nested exception is: Message[ failed to
    serialize interface javax.xml.soap.SOAPElementweblogic.xml.schema.binding.Serial
    izationException: mapping lookup failure. class=interface javax.xml.soap.SOAPEle
    ment class context=TypedClassContext{schemaType=['http://learn.technologies.com/
    WS']:PrintRequest}]StackTrace[
    [java] javax.xml.soap.SOAPException: failed to serialize interface javax.x
    ml.soap.SOAPElementweblogic.xml.schema.binding.SerializationException: mapping l
    ookup failure. class=interface javax.xml.soap.SOAPElement class context=TypedCla
    ssContext{schemaType=['http://learn.technologies.com/WS']:PrintRequest}
    [java] at weblogic.webservice.core.DefaultPart.invokeSerializer(Default
    Part.java:328)
    CODE
    // Setup the global SAAJ message factory
    System.setProperty("javax.xml.soap.MessageFactory", "weblogic.webservice.core.soap.MessageFactoryImpl");
    // Setup the global JAX-RPC service factory
    System.setProperty( "javax.xml.rpc.ServiceFactory", "weblogic.webservice.core.rpc.ServiceFactoryImpl");
    ServiceFactory serviceFactory = ServiceFactory.newInstance();
    // define qnames
    String targetNamespace = "http://learn.technologies.com/WS";
    QName serviceName = new QName(targetNamespace, "PersonalDataService");
    QName portName = new QName(targetNamespace, "PersonalDataInterface");
    QName operationName = new QName(targetNamespace, "Print");
    URL wsdlLocation = new URL("http://localhost:7001/simpleexample/PersonalDataInterface?WSDL");
    // create service
    Service service = serviceFactory.createService(wsdlLocation, serviceName);
    // create call
    Call call = service.createCall(portName, operationName);
    WSDL
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://learn.technologies.com/WS"
    targetNamespace="http://learn.technologies.com/WS">
    <types>
    <schema targetNamespace="http://learn.technologies.com/WS"
    xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <element name="PrintRequest">
    <complexType>
    <sequence>
    <element name="firstName" type="string"/>
    <element name="age" type="int"/>
    <element name="salary" type="double"/>
    </sequence>
    </complexType>
    </element>
    <element name="PrintResponse">
    <complexType>
    <sequence/>
    </complexType>
    </element>
    <element name="QueryRequest">
    <complexType>
    <sequence>
    <element name="id" type="double"/>
    </sequence>
    </complexType>
    </element>
    <element name="QueryResponse">
    <complexType>
    <sequence>
    <element name="return" type="tns:ArrayOfPersonalData"/>
    </sequence>
    </complexType>
    </element>
    <complexType name="PersonalData">
              <sequence>
              <element name="name" type="string"/>
              <element name="age" type="int"/>
              <element name="salary" type="double"/>
              </sequence>
    </complexType>
    <complexType name="ArrayOfPersonalData">
              <sequence>
              <element maxOccurs="unbounded" minOccurs="0" name="Item" type="tns:PersonalData"/>
              </sequence>
    </complexType>
    </schema>
    </types>
         <message name="PrintRequestMessage">
         <part name="PrintRequest" element="tns:PrintRequest"/>
         </message>
         <message name="PrintResponseMessage">
         <part name="PrintResponse" element="tns:PrintResponse"/>
         </message>
         <message name="QueryRequestMessage">
         <part name="QueryRequest" element="tns:QueryRequest"/>
         </message>
         <message name="QueryResponseMessage">
         <part name="QueryResponse" element="tns:QueryResponse"/>
         </message>
         <portType name="PersonalDataInterface">
              <operation name="Print">
                   <input name="PrintRequestMessage" message="tns:PrintRequestMessage"/>
              <output name="PrintResponseMessage" message="tns:PrintResponseMessage"/>
              </operation>
              <operation name="Query">
                   <input name="QueryRequestMessage" message="tns:QueryRequestMessage"/>
                   <output name="QueryResponseMessage" message="tns:QueryResponseMessage"/>
              </operation>
         </portType>
         <binding name="PersonalDataIntfBinding" type="tns:PersonalDataInterface">
         <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
         <operation name="Print">
              <soap:operation/>
              <input> <soap:body use="literal"/> </input>
              <output> <soap:body use="literal"/> </output>
         </operation>
         <operation name="Query">
              <soap:operation/>
              <input> <soap:body use="literal"/> </input>
              <output> <soap:body use="literal"/> </output>
         </operation>
         </binding>
         <service name="PersonalDataService">
         <port name="PersonalDataInterface" binding="tns:PersonalDataIntfBinding">
              <soap:address location="http://localhost:7001/simpleexample/PersonalDataInterface"/>
         </port>
         </service>
    </definitions>

    Exception is coming on following line (forgot
    to paste in first post)
         Object result = call.invoke(new Object[] { "Shakeel", new Integer (30), new Double(2000) });

  • Dynamic memory allocation

    Hi, guys, does anyone know whether I can use dyanmic memory allocation on the Real time system with "call library function" node. DLL is programmed using C language. Thanks.
    Machman

    You certainly can. LabVIEW Real-Time functionality is really not much different than what you can do on Windows. The only difference being that you can now assign priorty and timing to your execution loops; essentially, you have determinism with RT whereas with Windows, you never have a guarantee.
    Thus, in regards to calling a dll, you can perform this the same way you would in LabVIEW for Windows. Here's a KnowledgeBase article on how to do this if you're not already familiar.
    Cheers,
    Emilie K. | Applications Engineer | National Instruments

  • Why doesn't the debugger follow dynamic memory allocations well?

    Here's an example of a code block that doesn't seem to work right with the CVI compiler/debugger, but works fine with other C compilers/debuggers
    struct arg_int* arg_intn(const char* shortopts,
    const char* longopts,
    const char *datatype,
    int mincount,
    int maxcount,
    const char *glossary)
    size_t nbytes;
    struct arg_int *result;
    /* foolproof things by ensuring maxcount is not less than mincount */
    maxcount = (maxcount<mincount) ? mincount : maxcount;
    nbytes = sizeof(struct arg_int) /* storage for struct arg_int */
    + maxcount * sizeof(int); /* storage for ival[maxcount] array */
    result = (struct arg_int*)malloc(nbytes);
    if (result)
    /* init the arg_hdr struct */
    result->hdr.flag = ARG_HASVALUE;
    result->hdr.shortopts = shortopts;
    result->hdr.longopts = longopts;
    result->hdr.datatype = datatype ? datatype : "<int>";
    result->hdr.glossary = glossary;
    result->hdr.mincount = mincount;
    result->hdr.maxcount = maxcount;
    result->hdr.parent = result;
    result->hdr.resetfn = (arg_resetfn*)resetfn;
    result->hdr.scanfn = (arg_scanfn*)scanfn;
    result->hdr.checkfn = (arg_checkfn*)checkfn;
    result->hdr.errorfn = (arg_errorfn*)errorfn;
    /* store the ival[maxcount] array immediately after the arg_int struct */
    result->ival = (int*)(result+1);
    result->count = 0;
    /*printf("arg_intn() returns %p\n",result);*/
    return result;
    When I try to dereference this structure's 'ival[0]' the debugger constantly complains of a fatal runtime error and declares it out of the array bounds.
    This is from the argtable2 open source library available at http://argtable.sourceforge.net/ if you want to try and reproduce it.  I'm using CVI 2010 SP1.

    Unfortunately, you have run into one of the inherent limitations of CVI's run-time checking. Even though it is perfectly legal in C and somewhat common practice, our run-time checking doesn't like it when you conceptually split up a block of memory and treat it as two or more separate blocks. 
    While I cannot fix the problem in our run-time checking without breaking other use cases, I can explain what's causing the error and how you can work around it.
    When you malloc memory, we assume that the memory block is going to hold one or more instances of the type to which you're casting the memory block. In this case, CVI is treating the new memory block as an array of arg_info structures. But your new memory block is not big enough to hold more than one instance of struct arg_info, so we implicitly truncate the memory block to sizeof(struct arg_info). Because of the implicit truncation, s->values is now pointing past the end of the memory block and any access will result in an error.
    #include <ansi_c.h>
    struct arg_int {
    char some_large_block[64];
    int count;
    int *values;
    int main (int argc, char *argv[])
    int i, n = 4;
    struct arg_int *s = malloc(sizeof *s + n * sizeof *s->values);
    s->count = n;
    s->values = (int *)(s+1);
    for (i = 0; i < n; ++i)
    s->values[i] = i;
    return 0;
    You can avoid the implicit truncation in the original code by assigning to a (void*) first. This retains the original block size by keeping the actual type of the data in the memory block in limbo. Subsequent casts do not truncate the block. We truncate only when the cast occurs implicitly as part of a malloc. s->values points to the remainder of the block and you can access it freely, but you do not get any run-time checking on it.
    #include <ansi_c.h>
    struct arg_int {
    char some_large_block[64];
    int count;
    int *values;
    int main (int argc, char *argv[])
    int i, n = 4;
    struct arg_int *s;
    void *memory = malloc(sizeof *s + n * sizeof *s->values);
    s = memory;
    s->count = n;
    s->values = (int *)(s+1);
    for (i = 0; i < n; ++i)
    s->values[i] = i;
    return 0;
    If you want full run-time checking on s->values, you have to allocate the two components separately.
    #include <ansi_c.h>
    struct arg_int {
    char some_large_block[64];
    int count;
    int *values;
    int main (int argc, char *argv[])
    int i, n = 4;
    struct arg_int *s = malloc(sizeof *s);
    s->count = n;
    s->values = malloc(n * sizeof *s->values);
    for (i = 0; i < n; ++i)
    s->values[i] = i;
    return 0;
    Another option is to use an incomplete array. An incomplete array is an array of unspecified or zero size at the end of a structure definition. CVI is implicitly growing the array to fill up the rest of the allocated memory block. You do not get run-time checking for the array.
    #include <ansi_c.h>
    struct arg_int {
    char some_large_block[64];
    int count;
    int values[0];
    int main (int argc, char *argv[])
    int i, n = 4;
    struct arg_int *s = malloc(sizeof *s + n * sizeof *s->values);
    s->count = n;
    for (i = 0; i < n; ++i)
    s->values[i] = i;
    return 0;
    You can also disable run-time checking for your memory block by going through a series of casts: http://zone.ni.com/reference/en-XX/help/370051K-01/cvi/disablinguserprotectionforindividualpointer/
    Best regards.

  • Huge Memory Leak - Need help.

    Hi,
    There is a huge memory leak in our application. Because of this there are frequent session timeout. When we analysed the heap dump using Memory Analyser Tool, we got the leak suspects and the problem suspects are as below:
    One instance of "org.apache.jasper.compiler.JspRuntimeContext" loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x87ff8098" occupies 161,832,200 (23.30%) bytes. The memory is accumulated in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "<system class loader>".
    One instance of "org.apache.catalina.tribes.tipis.LazyReplicatedMap" loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x87ff8098" occupies 133,578,920 (19.23%) bytes. The memory is accumulated in one instance of "java.util.concurrent.ConcurrentHashMap$Segment[]" loaded by "<system class loader>".
    185 instances of "org.apache.jasper.runtime.BodyContentImpl", loaded by "org.apache.catalina.loader.StandardClassLoader @ 0x87ff8098" occupy 133,502,776 (19.22%) bytes.
    What could be the root cause for this error and how to resolve this?

    First, in general you not provided enough details to get any help. OS? OS version? Hardware specifics?
    Second, are you running custom code? If so, post it so you can get help.
    Third, if you're not running custom code, the odds of you having a "huge memory leak" are pretty small.

  • Finding dynamic memory allocations in core file

    Hi,
    Is it possible to find out which data structures were allocated by analysing a core file?
    I want to find out which objects are causing the memory to increase, and I have the core file of the program.
    Thanks in advance,
    Paulo

    It's almost impossible. Anyway, it would be pure heuristics - looking at stack contents, finding familiar patterns in heap, etc, etc.

  • 6085 Memory Problem - need help

    I have a new 2 Gb memory card installed in my 6085.  I have formatted the card and loaded some music using PC Suite.  I can get around 550 Megs of music loaded and when I try to load the next song I get a message "...cannot copy ______ the device has either stopped responding or has been disconnected..."  This happens when I get 550 Megs of music loaded - and the device is still connected.
    Also, when I try to download the English version of the user's manual I get an error message on my Adobe Reader screen which says  "the file is damaged and could not be repaired".
    Any help with these problems will be greatly appreciated.

    I have discovered that I can download the User's manual and open the document on my laptop.  The laptop has an older version of Adobe Reader (than the desktop where I was having the problem) which handles the downloaded file OK.
    I also have discovered that I can put more files onto my memory card if I put them into more folders.  There appears to be a limit on how many top level files or folders that can be on the memory card.  I discovered this by visiting the Kingston memory website.

  • Help with loading dynamic classes ..need help please

    i'm trying to design a program where by i can load dynamic classes
    the problem i'm getting is that only one class is loading.
    classes are loaded by their names,and index numbers of public methods from a linklist
    .When the program runs only the first class is ever loaded and only the methods of that class ..
    help please
    //class loader
    import java.lang.reflect.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class Test2 extends Thread
         public Class c;
         public Class Ray;
         public Class[] x;
         public static Object object = null;
         public Method[] theMethods;
         public static Method[] method,usemethod;
         public int methodcount;
         public static int MethodCt;     
         public static JList list;
    public Method[] startClass(String SetMethodName)
         try
              c = Class.forName(SetMethodName);
              object = c.newInstance();
              theMethods = c.getDeclaredMethods();
              // number of methods
              //methodcount = theMethods.length;
         catch (Exception e)
              e.printStackTrace();
    // return the array then invoke the particular method later
    return theMethods ;
    public void RunMethod(Method[] SomeMethod, int methodcount)
         try
              SomeMethod[methodcount].invoke( object,null );
         catch (Exception e)
              e.printStackTrace();
    // end class loader
    //main calling program
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing .*;
    import java.lang.reflect.*;
    public class JFMenu extends JFrame
         public static JMenu pluginMenu;
         public static JMenuBar bar;
         public static final Test2 w = new Test2();
    public static Method[] setmethod;
    private static ClassLinkList startRef = null;
    private static ClassLinkList linkRef3 = null;
    private static ClassLinkList startRef2 = null;
    private String ClassName,ShortCut;
    private int MethodNumber;
    private JMenuItem PluginItem;
         JFMenu()
              super (" JFluro ");     
              JMenu fileMenu = new JMenu("File");
              fileMenu.setMnemonic('F');
              JMenuItem exitItem = new JMenuItem("Exit");
              exitItem.setMnemonic('X');
              fileMenu.add(exitItem);
              exitItem.addActionListener
                   new ActionListener()
                        public void actionPerformed(ActionEvent event )
                             System.exit(0);
              JMenu pluginMenu = new JMenu("Plugins");
              pluginMenu.setMnemonic('P');
              startRef = new ClassLinkList ("Hello","Hello ",2,1926,"Painter");
              addToList("Foo","Foo ",0,1930,"Author");
              while (startRef.linkRef5 != null)
                   //pluginMenu.addSeparator();
                   ClassName = startRef.linkRef5.className;
                   ShortCut = startRef.linkRef5.shortcutName;
    MethodNumber = startRef.linkRef5.methodNumber;
    AddMenuItem(pluginMenu,ShortCut,ClassName,MethodNumber);
                   startRef.linkRef5 = startRef.linkRef5.next;
              // create menu bar and add JFMenu window to it
              JMenuBar bar = new JMenuBar();
              setJMenuBar(bar);
              bar.add(fileMenu);
              bar.add(pluginMenu);
              //attributes for JFMenu frame
              setSize(500,200);
              setVisible(true);
         }// end JFMenu constructor
         public void AddMenuItem(JMenu MainMenu, String shortcut,String className, final int methodCount )
              if (MainMenu==null)
                   return;
              //JMenuItem item;
              JMenuItem item = new JMenuItem(shortcut);
              MainMenu.add(item);
              setmethod = w.startClass(className);
              item.addActionListener
                   new ActionListener()
                        public void actionPerformed(ActionEvent event )
                             w.RunMethod(setmethod,methodCount);
              //item.addActionListener(ij);
         public JMenuItem AddMenuItem2(JMenu MainMenu, String shortcut)
              //if (MainMenu==null)
              //     return Main;
              //JMenuItem item;
              JMenuItem item = new JMenuItem(shortcut);
              MainMenu.add(item);
              //setmethod = w.startClass(className);
              //item.addActionListener(this);
                   new ActionListener()
                        public void actionPerformed(ActionEvent event )
                             w.RunMethod(setmethod,methodCount);
              //item.addActionListener(ij);
         return item;
         public void ReloadMenu(JMenuBar Bar, JMenu PluginMenu)
              if (Bar==null)
                   return;
              //     setJMenuBar(Bar);
              Bar.add(PluginMenu);
              //item.addActionListener(ij);
    public static void main (String args[])
              JFMenu menapp = new JFMenu();
    public static void addToList(String clname, String shcutname, int metnumber, int year2,
                                  String description) {
         // Create instance of class ClassLinkList
    ClassLinkList newRef = new ClassLinkList(clname,shcutname,metnumber,year2,
                                       description);
    // Add to linked list;
         startRef = startRef.addRecordToLinkedList(newRef);
    // end main calling program
    class Hello extends Thread
    public int getNum()
    System.out.println("I can be ");
    return 5;
    public void rayshowName()
    System.out.println("anything i want ");
    public void rayshowName3()
    System.out.println("to be ");
    class Foo extends Thread
    public int getNum()
    System.out.println("IMHOFF");
    return 5;
    public void rayshowName()
    System.out.println("raYMOND");
    // FAMOUS PERSONS LINKED LIST EXAMPLE
    // Frans Coenen
    // Saturday 15 January 2000
    // Depaertment of Computer Science, University of Liverpool
    class ClassLinkList {
    /* FIELDS */
    public String className;
    public String shortcutName;
    public int methodNumber;
    public int yearOfDeath;
    public String occupation;
    public ClassLinkList next = null;
    public ClassLinkList linkRef5 = this;
    public ClassLinkList startRef = null;
    /* CONSTRUCTORS */
    /* FamousPerson constructor */
    public ClassLinkList(String classname, String shortcutname, int methodnumber, int year2,
                                  String description) {
         className = classname;
         shortcutName = shortcutname;
         methodNumber = methodnumber;
         yearOfDeath = year2;
         occupation = description;
         next = null;
    /* METHODS */
    /* Output famous person linked list */
    public void outputClassLinkedList()
         //public ClassLinkList outputClassLinkedList() {
         ClassLinkList linkRef = this;
         // Loop through linked list till end outputting each record in turn
    while (linkRef != null)
         //System.out.println(linkRef5);
         System.out.println(linkRef.className + ", " + linkRef.shortcutName +
                   " (" + linkRef.methodNumber + "-" + linkRef.methodNumber +
                   "): " + linkRef.occupation);
         linkRef = linkRef.next;     
    //return linkRef;
    //public String ShowCasname()
    //return String ;     
    /* Add a new record to the linked list */
    public ClassLinkList addRecordToLinkedList(ClassLinkList newRef) {
         ClassLinkList tempRef, linkRef;
         // Test if new person is to be added to start of list if so return
    if (newRef.testRecord(this) ) {
         newRef.next = this;
         return(newRef);
         // Loop through remainder of linked list
         tempRef = this;
         linkRef = this.next;
         while (linkRef != null) {
         if (newRef.testRecord(linkRef)) {
         tempRef.next = newRef;
              newRef.next = linkRef;
              return(this);
         tempRef = linkRef;
         linkRef = linkRef.next;
    // Add to end
    tempRef.next = newRef;
         return(this);
    /* Delete a record from the linked list given the first and last name. Four
    posibilities:
    1) Record to be deleted is at front of list
    2) Record to be deleted is at end of list
    3) Record to be deleted is in middle of list
    4) Record not found. */
    public ClassLinkList deleteRecord(String lName, String fName) {
    ClassLinkList tempRef, linkRef;
    // Record at start of list
    if ((this.className == lName) & (this.shortcutName == fName))
         return(this.next);
         // Loop through linked list to discover if record is in middle of list.
         tempRef = this;
    linkRef = this.next;
    while (linkRef != null) {
         if ((linkRef.className == lName) & (linkRef.shortcutName == fName)) {
    tempRef.next = linkRef.next;
    return(this);
    tempRef = linkRef;
    linkRef = linkRef.next;
    // Record at end of list, or not found
    if ((linkRef.className == lName) & (linkRef.shortcutName == fName))
                        linkRef = null;
         else System.out.println("Record: " + lName + " " + fName + " not found!");
         return(this);
    /* TEST METHODS */
    /* Test whether new record comes before existing record or not. If so return
    true, false otherwise. */
    private boolean testRecord(ClassLinkList existingRef) {
         int testResult = className.compareTo(existingRef.className);
         if (testResult < 0) return(true);
         else {
         if ((testResult == 0) & (shortcutName.compareTo(existingRef.shortcutName) < 0 ))
                             return(true);
         // Return false
         return(false);
         public void addToList(String clname, String shcutname, int metnumber, int year2,
                                  String description)
         // Create instance of class Famous Person
    ClassLinkList newRef = new ClassLinkList(clname,shcutname,metnumber,year2,
                                       description);
    // Add to linked list;
         startRef = startRef.addRecordToLinkedList(newRef);

    I have a similar problem. I am writing a program to read the class names from database and instantiate several classes which extends from ServiceThread (an abstract class extending from Thread).
    rs = pStmt.executeQuery();
    while(rs.next()) {
    String threadclassname = rs.getString("classname").trim();
    try{
    ServiceThread threadinstance = (ServiceThread)Class.forName(threadclassname).newInstance();
    }catch ...
    So far, only the first class is ever instantiated and runs fine. But subsequent classes do not even get pass the "... ... Class.forName(...).newInstance();" line.
    Funny thing is that there are also no exceptions. The JVM just seem to hang there.

  • Multithread memory hog, need help

    I have written a program that seeks out a certain type of file from a directory tree structure. the program has to run in as little time as possible, but still has to go through thousands of directories. I threaded the below program but it takes up like 70 meg of memory. Is there anything I can do to make it smaller, or should I go back to square one. Also, this program is accessing files on a network drive. (Q:\ is a Maxtor MaxAttach storage server)
    THE CODE:
    import java.io.*;
    import java.io.OutputStream.*;
    import java.util.*;
    import java.sql.*;
    import java.io.*;
    import java.io.OutputStream.*;
    import java.util.*;
    import java.sql.*;
    public class Sort extends Thread{
         private File dir;
         private Stack list; //stack for found "papers"
         public static void main(String[] args){
              Stack list = new Stack();
              ThreadGroup t = new ThreadGroup("Papers");
              Sort a = new Sort(new File("Q:\\Users\\Clipper\\Scan"), list, t);
              a.start();
              try{Thread.sleep(2000);}
              catch(InterruptedException E){}
              while(t.activeCount() > 0){} // wait for the program to finish
              //insert all "papers" into a database
              Connection c = null;
              Statement s = null;
              try{
                   String geotel = "q:\\databases\\geotel.mdb";
                   String conStr2 = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + geotel;
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   c = DriverManager.getConnection(conStr2);
                   s = c.createStatement();
              catch(Exception e){}
              String line = null;
              try{line = (String)list.pop();}
              catch(EmptyStackException e){line = null;}
              while(line != null){
                   System.out.println(line);
                   try{s.execute(line);}
                   catch(SQLException e){System.out.println(e);}
                   try{line = (String)list.pop();}
                   catch(EmptyStackException e){line = null;}
         public Sort(File dir, Stack list, ThreadGroup t){
              super(t, dir.getAbsolutePath());
              this.dir = dir;
              this.list = list;
         public void run(){
              String s1 = dir.getAbsolutePath().trim();
              s1 = s1+"\\endfile.end";
              String s2 = dir.getAbsolutePath().trim();
              s2 = s2+"\\end.end";
              String s3 = dir.getAbsolutePath().trim();
              s3 = s3+"\\paper.paper";
              File f1 = new File(s1);
              File f2 = new File(s2);
              File paper = new File(s3);
              String pub = dir.getParentFile().getParentFile().getName();
              String date = dir.getParentFile().getName();
              //if what I'm looking for is there
              if(paper.exists()&&(!f1.exists())&&(!f2.exists())){
                   System.out.println(paper.getAbsolutePath());
                   try{ //an easy file marker
                        PrintWriter out = new PrintWriter(new
    FileOutputStream(s2));
                        out.println("marked");
                        out.close();
                   catch(Exception e){System.out.println(e);}
                   //push it on the stack
                   String q1 = "INSERT INTO Papers VALUES('"+paper.getAbsolutePath().trim()+"',"+pub+",'"+date+"',-1)";
                   list.push(q1);
              //otherwise launch new threads on all directories under the current one
              else{
                   File[] listing = dir.listFiles();
                   for(int i = 0; i<listing.length; i++){
                        if(listing.isDirectory()){
                             Sort a = new Sort(listing[i], list, this.getThreadGroup());
                             a.start();
                        try{sleep(500);}
                        catch(InterruptedException e){}
         System.gc();

    I think I have a better solution now.
    By the way. I was about to use but was a little wary of it. I never have used it before.                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • How to prevent playing video to ignore screensaver policy

    Our company policy is to make the screensaver (with password) active after 5 minutes. This works fine. But some employes found out to bypass the policy by playing a video in a loop. How can we deal with these retards?

  • Getting host name and port number from an application

    Does anyone know how I would be able to get the host name and port number from an application launched by java webstart ? This is the host and port of the URL that this application is launched from.

  • CS 5 Freezing

    Hello, I have been using photoshop CS 5 for about 6 months now, and have yet to have a problem with it (except one, but I wont get into that). Until reacently it has been running very smoothly. One day I was making a few things (400x300) so not that

  • Java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriveroracle.j

    My compile works just fine: javac mail_create.java but when I try to run I get OracleDriver error. Not sure how to fix this. Using RedHat Linux 7.3 [ora9ias@tautog classes]$ java mail_create Error: java.lang.ClassNotFoundException: oracle.jdbc.driver

  • New iMac November date?

    Anybody know what date in November the iMacs will arrive in stores specifically in the Fresno store?