You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean R. Owen (Jira)" <ji...@apache.org> on 2021/07/29 15:19:00 UTC

[jira] [Resolved] (SPARK-36326) Use Map.computeIfAbsent to simplify the process of HeapMemoryAllocator.bufferPoolsBySize init new item

     [ https://issues.apache.org/jira/browse/SPARK-36326?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean R. Owen resolved SPARK-36326.
----------------------------------
    Fix Version/s: 3.3.0
       Resolution: Fixed

Issue resolved by pull request 33558
[https://github.com/apache/spark/pull/33558]

> Use Map.computeIfAbsent to simplify the process of HeapMemoryAllocator.bufferPoolsBySize init new item
> ------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-36326
>                 URL: https://issues.apache.org/jira/browse/SPARK-36326
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core
>    Affects Versions: 3.3.0
>            Reporter: Yang Jie
>            Assignee: Yang Jie
>            Priority: Trivial
>             Fix For: 3.3.0
>
>
> HeapMemoryAllocator initializes the new element ofbufferPoolsBySizein the following way:
> {code:java}
> synchronized (this) {
>   LinkedList<WeakReference<long[]>> pool = bufferPoolsBySize.get(alignedSize);
>   if (pool == null) {
>     pool = new LinkedList<>();
>     bufferPoolsBySize.put(alignedSize, pool);
>   }
>   pool.add(new WeakReference<>(array));
> }
> {code}
> The codes can be simplified by Map.computeIfAbsent
>  
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org