Dear Sanjay,
Once u declare an Instance variable in a servlet, it is shared among all the
servlet threads in a multi-threaded model.
So declare it as an instance variable and initialize it in the init()
method.
See if it helps.
Actually I had tried it using a simple int variable and it gets shared among
all the servlet threads without making it static.
Pls. let me know if this is not the case.
Kau.


----- Original Message -----
From: "sanjay" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 11, 2002 11:17 AM
Subject: Servlet performance


> Hi all,
> I am using servlets with JNI .
> I am currently using  a JNI function which is being called by most of my
> servlets.This call is  made from servlet to fetch data from C++
> domain,which is collected into many arrays which are declared as public
> member variables of my servlet. Is there any method to avoid calling
> this JNI function in every other servlet and instead have a single call
> made only in one servlet, but without using static variables to store
> the values fetched ?
>
>
> This is basically to avoid increase of memory utilised .What I observed
> is that every access to a servlet increases memory by a certain amount
> (100KB), which eventually builds up to 50MB and later gets garbage
> collected ,down to 16 MB.I am using Tomcat version 3.2.1. , operating on
> windows NT.
>
> Kindly Help!!!!
> Regards
> San.
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to