Skip to content

Instantly share code, notes, and snippets.

@mvelikikh
Created August 21, 2020 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvelikikh/3306c657ab43ea1a32304114dc4c84d2 to your computer and use it in GitHub Desktop.
Save mvelikikh/3306c657ab43ea1a32304114dc4c84d2 to your computer and use it in GitHub Desktop.
create or replace package pkg
is
MAX_VC_LEN constant binary_integer := 32767;
type char_tbl_type is table of varchar2(MAX_VC_LEN);
v_tbl char_tbl_type := char_tbl_type();
procedure fill_memory;
procedure tiny_allocation;
procedure huge_allocation;
procedure small_allocation;
end;
/
create or replace package body pkg
is
procedure fill_memory
is
begin
tiny_allocation;
huge_allocation;
small_allocation;
end fill_memory;
procedure tiny_allocation
is
v_start_size pls_integer := v_tbl.count;
v_extend_size constant pls_integer := 1000;
begin
v_tbl.extend(v_extend_size);
for i in 1..v_extend_size
loop
v_tbl(v_start_size + i) := lpad('x', MAX_VC_LEN, 'x');
end loop;
end tiny_allocation;
procedure huge_allocation
is
v_start_size pls_integer := v_tbl.count;
v_extend_size constant pls_integer := 38500*2;
begin
v_tbl.extend(v_extend_size);
for i in 1..v_extend_size
loop
v_tbl(v_start_size + i) := lpad('x', MAX_VC_LEN, 'x');
end loop;
end huge_allocation;
procedure small_allocation
is
v_start_size pls_integer := v_tbl.count;
v_extend_size constant pls_integer := 3000;
begin
v_tbl.extend(v_extend_size);
for i in 1..v_extend_size
loop
v_tbl(v_start_size + i) := lpad('x', MAX_VC_LEN, 'x');
end loop;
end small_allocation;
end;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment