# Resize! error in 1.11

**URL:** <https://discourse.julialang.org/t/resize-error-in-1-11/122777>\
**Category:** General Usage\
**Created:** [November 18, 2024, 2:38pm UTC](https://discourse.julialang.org/t/resize-error-in-1-11/122777 "2024-11-18T14:38:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [November 18, 2024, 2:38pm UTC](https://discourse.julialang.org/t/resize-error-in-1-11/122777/1 "2024-11-18T14:38:40Z")

</div>

I tried out the old example code from 2018 at this [link](https://discourse.julialang.org/t/realtime-plotting/15638/5) for some real time plotting.

It errored in 1.11.1 with a resize! error. When I tried it in 1.10.6 it worked fine. I am assuming there should be a new method written for resize?

The error is:

```julia
julia> gplot = testanimplot()
ERROR: MethodError: no method matching resize!(::Memory{UInt8}, ::Int64)
The function `resize!` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  resize!(::Gtk.GtkWindow, ::Integer, ::Integer)
   @ Gtk C:\Users\jakez\.julia\packages\Gtk\oo3cW\src\windows.jl:18
  resize!(::BitVector, ::Integer)
   @ Base bitarray.jl:814
  resize!(::Vector, ::Integer)
   @ Base array.jl:1436

```

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [November 18, 2024, 2:58pm UTC](https://discourse.julialang.org/t/resize-error-in-1-11/122777/2 "2024-11-18T14:58:10Z")

</div>

Are there more lines in the error message that you did not paste? I miss a reference to the function that calls `resize!`, since the code of example that you link does not contain it.

In any event, it seems that the problem is in some function belonging to Gtk.jl, which might be using some non-API feature of Julia no longer working in 1.11.

Unfortunately, the Github of Gtk.jl tells that that package is no longer maintained. Perhaps modifying the example (from a very old, 2018 post) to make it work with Gtk4.jl may help.

---

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [November 18, 2024, 8:41pm UTC](https://discourse.julialang.org/t/resize-error-in-1-11/122777/3 "2024-11-18T20:41:04Z")

</div>

I thought there might be other places the `resize!(::Memory{UInt8}, ::Int64)` command is used so that there might need to be a method for this, perhaps I am wrong?

The complete stacktrace is shown.

```julia
julia> show(err)
1-element ExceptionStack:
MethodError: no method matching resize!(::Memory{UInt8}, ::Int64)
The function `resize!` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  resize!(::Gtk.GtkWindow, ::Integer, ::Integer)
   @ Gtk C:\Users\jakez\.julia\packages\Gtk\oo3cW\src\windows.jl:18
  resize!(::BitVector, ::Integer)
   @ Base bitarray.jl:814
  resize!(::Vector, ::Integer)
   @ Base array.jl:1436

Stacktrace:
  [1] string_formatted(v::Float64, fmt::NumericIO.IOFormattingReal; showexp::Bool)
    @ NumericIO C:\Users\jakez\.julia\packages\NumericIO\dwKCe\src\NumericIO.jl:395
  [2] formatted(v::Float64, fmt::NumericIO.IOFormattingReal; showexp::Bool)
    @ NumericIO C:\Users\jakez\.julia\packages\NumericIO\dwKCe\src\NumericIO.jl:427
  [3] render_ticklabel(ctx::Cairo.CairoContext, val::Float64, pt::InspectDR.Point2D, font::InspectDR.Font, align::InspectDR.CAlignment, fmt::InspectDR.TickLabelFormatting, ::InspectDR.LinScale{1})
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\cairo_axes.jl:135
  [4] render_yticks(ctx::Cairo.CairoContext, rstrip::InspectDR.RStrip2D, lyt::InspectDR.PlotLayout, ylines::InspectDR.GridLines)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\cairo_axes.jl:206
  [5] render_ticks(ctx::Cairo.CairoContext, rstrip::InspectDR.RStrip2D, lyt::InspectDR.PlotLayout, xticklabels::Bool)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\cairo_axes.jl:272
  [6] render_axes
    @ C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\cairo_axes.jl:283 [inlined]
  [7] render_axes(ctx::Cairo.CairoContext, rplot::InspectDR.RPlot2D, plot::InspectDR.Plot2D)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\cairo_top.jl:27
  [8] render(bplot::InspectDR.CairoBufferedPlot, plot::InspectDR.Plot2D, bb::Graphics.BoundingBox, refreshdata::Bool)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\cairo_top.jl:105
  [9] render(pwidget::InspectDR.PlotWidget; refreshdata::Bool)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_base.jl:302
 [10] render
    @ C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_base.jl:287 [inlined]
 [11] InspectDR.PlotWidget(plot::InspectDR.Plot2D)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_top.jl:239
 [12] InspectDR.PlotWidget(gplot::InspectDR.GtkPlot, plot::InspectDR.Plot2D)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_top.jl:245
 [13] sync_subplots(gplot::InspectDR.GtkPlot)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_top.jl:258
 [14] InspectDR.GtkPlot(mp::InspectDR.Multiplot)
    @ InspectDR C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_top.jl:328
 [15] #GtkPlot#113
    @ C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_top.jl:351 [inlined]
 [16] GtkPlot
    @ C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_top.jl:348 [inlined]
 [17] display
    @ C:\Users\jakez\.julia\packages\InspectDR\hCnVD\src\gtk_top.jl:397 [inlined]
 [18] buildanimplot()
    @ Main .\REPL[9]:24
 [19] testanimplot()
    @ Main .\REPL[11]:8
 [20] top-level scope
    @ REPL[12]:1
julia>

```

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [November 18, 2024, 9:12pm UTC](https://discourse.julialang.org/t/resize-error-in-1-11/122777/4 "2024-11-18T21:12:18Z")

</div>

`Memory` is a new type in Julia 1.11 which is the new fundamental memory allocation type. It doesn’t have a `resize!` function. It looks like NumericIO.jl is accessing some internal field that used to be a `Vector` (which supports `resize!`) but is now a `Memory`. But that’s just a guess.

---

<div class="post-metadata">

**Author:** ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)\
**Post date:** [November 19, 2024, 3:08am UTC](https://discourse.julialang.org/t/resize-error-in-1-11/122777/5 "2024-11-19T03:08:42Z")

</div>

The offending function around line 395 is

```julia
#One-off solution to formatting individual values:
function string_formatted(v::Real, fmt::IOFormattingReal; showexp::Bool=true)
	s = IOBuffer()
	print_formatted(s, v, fmt, showexp=showexp)
	d = s.data
	resize!(d, s.size)
	return String(d)
end

```

I have opened an issue for NumericIO.jl.
