It seems to be the large size of independent delete operations that
causes the OOM error. Maybe you should first delete all nodes in a
single run:
1. delete //*[empty(@mark)]
2. db:optimize($db, true())
What will be the resulting database size after these two steps?
In general, you can always increase the amount of memory assigned to
Java via -Xmx [1].
Hope this helps,
Christian
[1]
http://docs.basex.org/wiki/Start_Scripts
docs.basex.org
Main Package. The following scripts can be used to launch the standalone version of BaseX. Please replace the class name in org.basex.BaseX with either BaseXClient, ...
|
> The stacktrace as requested
>
>> xquery for $e in //* let $m := $e/@mark return if($m) then (
>> delete node $m, (: [.] is same as: where $d ne "" :) for $d in
>> data($m)[.] return ( delete node $e/text() ) ) else (
>> delete node $e )
> java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Unknown Source)
> at org.basex.util.hash.IntSet.rehash(IntSet.java:125)
> at org.basex.util.hash.IntObjMap.rehash(IntObjMap.java:55)
> at org.basex.util.hash.ASet.checkSize(ASet.java:82)
> at org.basex.util.hash.IntSet.index(IntSet.java:109)
> at org.basex.util.hash.IntSet.put(IntSet.java:49)
> at org.basex.util.hash.IntObjMap.put(IntObjMap.java:29)
> at org.basex.query.up.DataUpdates.add(DataUpdates.java:77)
> at org.basex.query.up.ContextModifier.add(ContextModifier.java:56)
> at org.basex.query.up.DatabaseModifier.add(DatabaseModifier.java:40)
> at org.basex.query.up.Updates.add(Updates.java:96)
> at org.basex.query.up.expr.Delete.item(Delete.java:44)
> at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:44)
> at org.basex.query.QueryContext.iter(QueryContext.java:409)
> at org.basex.query.expr.If.iter(If.java:126)
> at org.basex.query.expr.gflwor.GFLWOR$1.next(GFLWOR.java:100)
> at org.basex.query.MainModule.cache(MainModule.java:100)
> at org.basex.query.QueryContext.iter(QueryContext.java:345)
> at org.basex.query.QueryProcessor.iter(QueryProcessor.java:81)
> at org.basex.core.cmd.AQuery.query(AQuery.java:90)
> at org.basex.core.cmd.XQuery.run(XQuery.java:22)
> at org.basex.core.Command.run(Command.java:398)
> at org.basex.core.Command.execute(Command.java:100)
> at org.basex.api.client.LocalSession.execute(LocalSession.java:132)
> at org.basex.api.client.Session.execute(Session.java:36)
> at org.basex.core.CLI.execute(CLI.java:103)
> at org.basex.core.CLI.execute(CLI.java:87)
> at org.basex.BaseX.console(BaseX.java:191)
> at org.basex.BaseX.<init>(BaseX.java:166)
> at org.basex.BaseX.main(BaseX.java:42)
> org.basex.core.BaseXException: Out of Main Memory.
> at org.basex.core.Command.execute(Command.java:101)
> at org.basex.api.client.LocalSession.execute(LocalSession.java:132)
> at org.basex.api.client.Session.execute(Session.java:36)
> at org.basex.core.CLI.execute(CLI.java:103)
> at org.basex.core.CLI.execute(CLI.java:87)
> at org.basex.BaseX.console(BaseX.java:191)
> at org.basex.BaseX.<init>(BaseX.java:166)
> at org.basex.BaseX.main(BaseX.java:42)
> Out of Main Memory.
>
>
> ________________________________
> Från: Christian Grün <christian.gruen@gmail.com>
> Skickat: den 9 juli 2016 22:24
> Till: Henning Phan
> Ämne: Re: [basex-talk] Removing the xmlns attribute and/or adding the prefix
>
>> for $e in //* let $m := $e/@mark return if($m) then ( delete node
>> $m, (: [.] is same as: where $d ne "" :) for $d in data($m)[.]
>> return ( delete node $e/text() ) ) else ( delete node $e
>> )
>>
>> Runs out of memory.
>
> Thanks for trying. Could you please pass me on the stack trace? If it
> doesn’t show up immediately, you may need to switch on debugging (via
> SET DEBUG true, or -d on command line).