[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #FIQ-462285]: Memory leak capturing image



> Hi Yuan,
> 
> Thank you very much for your quick guidance.
> I just run  IDV interactively.  I build the project using idv3.0b1 
> source code and dataset download from your website.


I will re visit this ticket in a couple weeks, we are in the moving process to 
another build.


Yuan
> Only  the  DataControlDialog.java file, I modify the method doOk() 
> as bellow:
> *************************************************
>  public void doOk() {
> //        doApply();
> 
> //        if (inOwnWindow) {
> 
> //            
> doClose();
> 
> //        }
> 
>         getOffViewManager("imageserver", 1024 * 
> 2, 768 * 2);
>         Thread t = new Thread() {
>             public void run() {
>                 
> while (true) {
>                 
>     try {
>                 
>         ViewManager vm = 
> idv.getVMManager().findViewManager(
>                 
>                 
> new ViewDescriptor("imageserver"));
>                 
>         if (vm != null) {
>                 
>             
> vm.getMaster().saveCurrentDisplay(
>                 
>                 
>     new File("D:\\image\\" + System.currentTimeMillis() + 
> ".jpg"), true, true);
>                 
>         }
>                 
>         Thread.sleep(10);
>                 
>     } catch (Exception ex) {
>                 
>         ex.printStackTrace();
>                 
>     }
>                 }
>             }
>         };
>         t.start();    
>     }
> 
>     private void getOffViewManager(String viewId, int width, 
> int height) {
>         List vmNameList = new ArrayList();
>         
> vmNameList.add(MapViewManager.class.getName());
>         ViewDescriptor viewDescriptor = new 
> ViewDescriptor(viewId);
>         
> viewDescriptor.setClassNames(vmNameList);
>         ViewManager vm = 
> idv.getVMManager().findViewManager(viewDescriptor);
>         if (vm == null) {
>             
> idv.getArgsManager().setIsOffScreen(true);
> 
>             Dimension size 
> =idv.getStateManager().getViewSize();
>             Dimension 
> offscreenSize = new Dimension(width, height);
>             
> idv.getStateManager().setViewSize(offscreenSize);
>             vm = 
> idv.getViewManager(viewDescriptor);
> 
>             
> vm.getMaster().getDisplayComponent().setSize(offscreenSize);
> 
>             
> idv.getStateManager().setViewSize(size);
> 
>             
> idv.getArgsManager().setIsOffScreen(false);
>         }
>     }
> ****************************************************
> 
> I start project by parameter:-Xmx1024m -Xms1024m -XX:PermSize=128m 
> -XX:MaxPermSize=128m
> In  User Preference->System page, I uncheck "Enable geometry by 
> reference".
> So when I start idv ,add datasource , select a field  and press"Create 
> Display" button, the offscreen viewManager start generating images.
> 
> During running, memory used as below:
> ************************
> 315/1038/1038MB
> 289/1038/1038MB
> 421/1038/1038
> 309/1038/1038
> 632/1038/1038
> 747~565/1038/1038    
> 1010~243/1038/1038 
> 970~539/1038/1038
> 1014~863/1038/1038    
> 1025/1038/1038       
> *************************
>  We can see that at beginning  memory usage is on the rise but fall 
> later.  After a while, memory usage is on the rise but hardly fall 
> down.  When memory used is 1025, memory heap has occured.  About 30 
> minutes from project start.
> 
> Though I use same dataset as you, but the image comes form an empty 
> viewManager with only a background world map. No need to query data from 
> datasource.
> 
> ------------------------------------------------
> 
> > Hi Yuan ,
> 
> > Thank you for your suggestion.  But the problem occured as 
> > before. 
> 
> > Increasing  JVM memory to 1024M, the error occured after  
> > twenty-four minutes .  When I set it to 512M before, error occured 
> > after ten minutes.
> 
> > Bellow is the memory situation caputured by JConsole tool.
> 
> >
> 
> >
> 
> > By the way , I'm a student and I  help others do some work in my spare 
> > time.
> 
> >
> 
> > Cindy
> 
> >
> 
> 
> 
> Hi Cindy,
> 
> I am a little surprised that you are student, you are showing very good Java 
> programming skill.
> 
> I wonder if you ever run the same dataset in the IDV interactively, if not, 
> please give a try, and let us know the memory usage. Also, provide me some 
> information of the dataset you are working on.
> 
> 
> 
> 
> 
> Yuan
> 
> 
> 
> 
> 
> >
> 
> > ------------------------------------------------
> 
> >
> 
> > > Hi,
> 
> >
> 
> > >
> 
> >
> 
> > > Thank you very much for your letter.  Could you please run the code 
> > > I send you as an attachment? 
> 
> >
> 
> > > By the way, My machine memory is 2GB.  JVM parameter is: -Xmx512m 
> > > -Xms512m -XX:PermSize=128m -XX:MaxPermSize=128m
> 
> >
> 
> > >
> 
> >
> 
> > > Cindy.
> 
> >
> 
> > >  
> 
> >
> 
> > >
> 
> >
> 
> >
> 
> >
> 
> > The memory allocated to the IDV is too small, you can increase to 1024m. 
> > This should solve your problem assuming the image created is reasonable. By 
> > the way, which meteorological institute do you work in?
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> > Yuan
> 
> >
> 
> >
> 
> >
> 
> >
> 
> >
> 
> > Ticket Details
> 
> >
> 
> > ===================
> 
> >
> 
> > Ticket ID: FIQ-462285
> 
> >
> 
> > Department: Support IDV
> 
> >
> 
> > Priority: Normal
> 
> >
> 
> > Status: Closed
> 
> >
> 
> >
> 
> >
> 
> >
> 
> 
> 
> 
> 
> Ticket Details
> 
> ===================
> 
> Ticket ID: FIQ-462285
> 
> Department: Support IDV
> 
> Priority: Normal
> 
> Status: Closed
> 
> 
> 
> 


Ticket Details
===================
Ticket ID: FIQ-462285
Department: Support IDV
Priority: High
Status: Open


NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.