Hello, I've created a scheduler service and noticed a memory leak. I'm using
the exact code below to perform the test. I read an article related to class
reloading causing memory leaks,
http://tapestry.apache.org/class-reloading.html However, I don't really
understand what is being implied. I'm wondering if I'm doing something wrong
to cause this issue. After running the app from 14:56:23.026 through
15:16:30.222 with one second memory printouts I've noticed the following
loss. 

Available memory JVM (bytes) 8826784 14:56:23.026 
Available memory JVM (bytes) 6906536 15:16:30.222

//appmodule
    public static void bind(ServiceBinder binder) {
        binder.bind(SchedulerService.class, SchedulerServiceImpl.class);
    }

    @Startup
    public static void initApplication(SchedulerService scheduler) {
        scheduler.init();
    }


    public static AutocompleteCacheService<ApplicationUser>
buildUserAutocompleteCache() {
        return new AutocompleteCacheServiceImpl<ApplicationUser>() {
        };
    }

    public static AutocompleteCacheService<IfasvVendor>
buildVendorAutocompleteCache() {
        return new AutocompleteCacheServiceImpl<IfasvVendor>() {
        };
    }

    public static AutocompleteCacheService<IfasvRequisitionCode>
buildRequisitionAutocompleteCache() {
        return new AutocompleteCacheServiceImpl<IfasvRequisitionCode>() {
        };
    }

    public static AutocompleteCacheService<Evaluator>
buildEvaluatorAutocompleteCache() {
        return new AutocompleteCacheServiceImpl<Evaluator>() {
        };
    }

//Impl
public class SchedulerServiceImpl implements SchedulerService {
    
    @Inject
    private RemoteUserSync remoteUserSync;
    
    @Inject
    private Session session;
    
    @Inject
    private PeriodicExecutor executor;
    
    @InjectService("userAutocompleteCache") 
    private AutocompleteCacheService<ApplicationUser> userAutocompleteCache;
    
    @InjectService("vendorAutocompleteCache") 
    private AutocompleteCacheService<IfasvVendor> vendorAutocompleteCache;
    
    @InjectService("requisitionAutocompleteCache") 
    private AutocompleteCacheService<IfasvRequisitionCode>
requistionAutocompleteCache;
    
    @InjectService("evaluatorAutocompleteCache") 
    private AutocompleteCacheService<Evaluator> evaluatorAutocompleteCache;
    
    public SchedulerServiceImpl() {
    }
    
    public void init() {
        this.autocompleteCacheUpdate();
    }

    private void autocompleteCacheUpdate() {
        this.executor.addJob(ScheduleUtils.secondlySchedule(1),
            "Autocomplete Cache Updates",
            new Runnable() {                
                public void run() {
                    memoryUsage();
                   
System.out.println("*******************Completed**********************");
                }                
            });
    }

    public void memoryUsage() {
    /* Total amount of free memory available to the JVM */
    System.out.println("Available memory JVM (bytes): " + 
        Runtime.getRuntime().freeMemory());
        
    }

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Memory-Leak-tp5713668.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to