• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.OutOfMemoryError: unable to create new native thread  RSS feed

 
Rangini Ramchander
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am facing the problem.

java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start(Native Method)
at com.realsoftinc.admc.adminagent.AdminAgent$Trapper.run(Unknown
Source)

we used the code:

public class Trapper extends Thread {

public void run() {
int i = 0;
AdmcTrapStruct trapObj;

while (true) {
System.out.println("****the Size of the Trap is:*****" +trapList.size());
synchronized (trapList) {
try {
trapList.wait(000);
if (trapList.isEmpty()) {
continue;
} else {
for (int j = 0; j < (trapList.size()); ++j) {
//Remove the Object from Vector, will get the
// reference
trapObj = (AdmcTrapStruct) trapList.remove(j);
//Call the SendDestination Thread class which
// will process the trapObj
SendDestination destins = new SendDestination(trapObj);
destins.start();
}
}
} catch (InterruptedException ie) {


modules add trap object to this list. Trapper class processes these
traps one by one. Since processing traps requires to go through complex filter
rules and send to destination, it takes time. Trapper vector may grow based on
number of traps originating. If it is continously growing


please give me solution for this problem.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A standard solution would be to limit the size of the queue and reject all attempts to add more to it.
Processes that do want to add something to the queue will then have to wait (they block) until there's room available.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!