DROP FUNCTION IF EXISTS test_func;
CREATE OR REPLACE FUNCTION test_func(x integer) RETURNS Oid[] AS $$
  SELECT array_agg(id) AS arr FROM generate_series(1, x, 1) AS id
$$ LANGUAGE SQL IMMUTABLE;

EXPLAIN (SUMMARY ON)
SELECT relname FROM pg_class c1
WHERE oid = ANY (test_func(100));

/*
elems, memory_consumed
1		12kB
100		37kB
10000	2.6MB
 */