Could not allocate dup blob fd

1

Ihaveapproximately1,500markersonamapthatarebeingshownthroughclusterssoasnottooverloadtheapplication.thesebookmarksarecurrentlydisplayedasBitmapDescriptorFactory.defaultMarker()

However,whenImodifythecodeforeachdottoshowacustombitmapwithvaluesonmarkers,onlyafewdeviceshavethiserror,includingLGK10LTEandsomeMotorolas.Mostdevicesworknormally.

WhenIusethisfunction,beforeIfinishrenderingall1500markers,itcrasheswiththefollowingerror:

"Could not allocate dup blob fd."

In research on this error, it seems to me that this is a memory overflow and that I should store these markers in LRU cache, but I can not do this in conjunction with the clusters.

Has anyone had this or have you had any ideas / suggestions to solve this problem?

Below is the bitmaps renderer code snippet:

public class OwnRendring extends DefaultClusterRenderer<MyItem> {

    OwnRendring(Context context, GoogleMap map, ClusterManager<MyItem> clusterManager) {
        super(context, map, clusterManager);
    }

    protected void onBeforeClusterItemRendered(MyItem item, MarkerOptions markerOptions) {

        markerOptions.snippet(item.getSnippet());
        markerOptions.title(item.getTitle());
        markerOptions.anchor(0.33f, 1f);
        markerOptions.infoWindowAnchor(0.33f,0f);

        int cor = (item.getPublico() ? cfgCorPostoPublico : cfgCorPostoPrivado);
        String preço = item.getTitle().substring(item.getTitle().length() - 5);

        markerOptions.icon(BitmapDescriptorFactory.fromBitmap(createMarker(preço, cor)));
        super.onBeforeClusterItemRendered(item, markerOptions);

    }

    protected boolean shouldRenderAsCluster(Cluster cluster) {
        return cfgCluster && cluster.getSize() >= cfgClusterMin;
    }
}

@Override
public void onCameraIdle() {mClusterManager.cluster();}

private Bitmap createMarker(String text, int color) {
    View markerLayout = getLayoutInflater().inflate(R.layout.custom_marker, null);

    ImageView markerImage = markerLayout.findViewById(R.id.marker_image);
    TextView markerRating = markerLayout.findViewById(R.id.marker_text);
    markerImage.setImageResource(R.drawable.pin_shadow);
    markerImage.clearColorFilter();
    markerImage.getDrawable().mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY );
    markerRating.setText(text);

    markerLayout.measure(
            View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
            View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
    markerLayout.layout(0, 0, markerLayout.getMeasuredWidth(), markerLayout.getMeasuredHeight());

    final Bitmap bitmap = Bitmap.createBitmap(
            markerLayout.getMeasuredWidth(),
            markerLayout.getMeasuredHeight(),
            Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    markerLayout.draw(canvas);
    return bitmap;
}
    
asked by anonymous 23.05.2017 / 04:50

0 answers