Created
August 21, 2020 13:34
-
-
Save mvelikikh/3306c657ab43ea1a32304114dc4c84d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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