Pre loader

Bug: Large Heatmap crashes with SIGSEGV


I have created a HeatMap with the size of 25000 x 70. The application crashes with the following log:

E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
E/libEGL: call to OpenGL ES API with no current context (logged once per thread)
I/OpenGLRenderer: Initialized EGL, version 1.4
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without…
D/EGL_emulation: eglCreateContext: 0x7faef90b6500: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x7faef90b6500: ver 2 0 (tinfo 0x7faf0489eec0)
D/EGL_emulation: eglMakeCurrent: 0x7faef90b6500: ver 2 0 (tinfo 0x7faf0489eec0)
D/EGL_emulation: eglCreateContext: 0x7faf04b65680: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0x7faf04b65680: ver 2 0 (tinfo 0x7faf04b7e500)
E/emuglGLESv2_enc: device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glTexImage2D:1908 GL error 0x501 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x41a10f90 in tid 2736 (GLThread 973)

Below is Kotlin code from my sample project that produces the error:

private const val WIDTH = 25000
private const val HEIGHT = 70

class MainActivity : AppCompatActivity()
    private lateinit var chartBuilder: SciChartBuilder

    override fun onCreate(savedInstanceState: Bundle?)

        chartBuilder = SciChartBuilder.instance()

        val background = findViewById<ViewGroup>(

        val chartSurface = createChartSurface()


    private fun createChartSurface(): SciChartSurface
        val surface = SciChartSurface(this)

        val xAxis = chartBuilder.newNumericAxis().build()
        val yAxis = chartBuilder.newNumericAxis().build()


        surface.renderableSeries.add(createSeries(WIDTH, HEIGHT))

        return surface

    private fun createSeries(width: Int, height: Int): FastUniformHeatmapRenderableSeries
        val dataSeries = UniformHeatmapDataSeries(Int::class.javaObjectType, Int::class.javaObjectType, Float::class.javaObjectType, width, height)

        return chartBuilder.newUniformHeatmap()
            .withColorMap(ColorMap(intArrayOf(ColorUtil.DarkBlue, ColorUtil.CornflowerBlue, ColorUtil.DarkGreen, ColorUtil.Chartreuse, ColorUtil.Yellow, ColorUtil.Red), floatArrayOf(0f, 0.2f, 0.4f, 0.6f, 0.8f, 1f)))

    private fun addPoints(chartSurface: SciChartSurface)
        val dataSeries = chartSurface.renderableSeries.first().dataSeries as UniformHeatmapDataSeries<Int, Int, Float>

        val xRange = 0 until WIDTH

        for (i in 0 until HEIGHT)
            val values = { (i + it).toFloat() }
            dataSeries.updateRangeZAt(0, i, values)

        val renderableSeries = chartSurface.renderableSeries.first() as FastUniformHeatmapRenderableSeries
        renderableSeries.minimum = dataSeries.zValues.minimum.toDouble()
        renderableSeries.maximum = dataSeries.zValues.maximum.toDouble()
  • You must to post comments

I think the heatmap is limited by maximum texture size in OpenGL. Query that using code like this.

int[] maxTextureSize = new int[1];
GLES10.glGetIntegerv(GL10.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0);


Canvas canvas = new Canvas();
canvas.getMaximumBitmapHeight() / 8

Then you can tile heat maps. For example, this case study was created by tiling Heatmaps in our Windows version of SciChart. They achieved a total of 100 million cells (10M x 10M)!

Best regards,

  • You must to post comments

Hi Miha,

I’m not sure that it’s a bug, you just reached limitation of OpenGL texture size which we use to draw heatmap. FastUniformHeatmapRenderableSeries just wasn’t designed for drawing of so large heatmaps and I’m not sure if there is something we can do without rewriting entire series. Anyway I logged this issue into our bug tracker and we’ll try to improve situation in one of our next releases.

Best regards,

  • MIha Rozina
    Thank you for your answer. I guess I will now try to implement s custom renderable series as you suggested in another answer.
  • Gang Xu
    Hi Yura, I am also interested in this topic. Is there a way that we can determine the maximum OpenGL texture size (width and height) before creating the FastUniformHeatmapRenderableSeries? Thanks.
  • Andrew Burnett-Thompson
    I created a new answer below. Please have a look!
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies