[ 
https://issues.apache.org/jira/browse/LUCENE-9286?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17074759#comment-17074759
 ] 

Bruno Roustant commented on LUCENE-9286:
----------------------------------------

Thanks Dawid.

I think I found a better solution that will work seamlessly. Since most of the 
time we want a deep copy semantics, we cannot rely on a shallow copy option.

During the BitTable copy, there will be two cases:
1- When the long[] array is rather small, copy the array, with an optimization 
to reuse the existing long[] (instead of always creating a new one) and copy 
bits. This will make the reuse of scratch Arc faster and require less transient 
memory.
2- When the long[] array is large, just copy the pointer to the FST bytes where 
to read the BitTable bits. And then lazy initialize the copy when any BitTable 
method is called, by reading the bits. A copy of this copy should also copy 
only the pointer with lazy initialization.
Could we work directly on the FST bytes without storing them? I'm not sure, but 
I'll check that option also.

> FST construction explodes memory in BitTable
> --------------------------------------------
>
>                 Key: LUCENE-9286
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9286
>             Project: Lucene - Core
>          Issue Type: Bug
>    Affects Versions: 8.5
>            Reporter: Dawid Weiss
>            Assignee: Bruno Roustant
>            Priority: Major
>         Attachments: screen-[1].png
>
>
> I see a dramatic increase in the amount of memory required for construction 
> of (arguably large) automata. It currently OOMs with 8GB of memory consumed 
> for bit tables. I am pretty sure this didn't require so much memory before 
> (the automaton is ~50MB after construction).
> Something bad happened in between. Thoughts, [~broustant], [~sokolov]?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to