Home  >  Q&A  >  body text

mysql - java.lang.OutOfMemoryError: GC overhead limit exceede

我开了很多个线程爬取网页上的信息,然后将这些信息写入数据库。
但是不管我开启多少个线程,每当写入数据库三万多条记录之后就会报出下面这个异常,请问如何解决呢???

PHP中文网PHP中文网2728 days ago759

reply all(3)I'll reply

  • 怪我咯

    怪我咯2017-04-18 09:35:48

    Your sql connection is neither reused nor closed...

    There is a way to treat the symptoms but not the root cause, which is to increase the memory of the jvm.
    Startup parameters Riga-Xms512m-Xmx1024m

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 09:35:48

    1. Put out the GC detailed log and observe the memory GC situation

    2. Dump the memory snapshot at that time and observe which objects occupy the memory

    PS: It is estimated that there are large objects. The large objects directly enter the old generation and still hold references to the large objects in the application

    reply
    0
  • 阿神

    阿神2017-04-18 09:35:48

    My friends helped me guess the conclusion, you can give it a try

    http://www.yl1001.com/group_article/1721468995450102.htm?classic_id=7691469068392318#comment_7691469068392318

    reply
    0
  • Cancelreply