Memory registration

When you register a user-defined function or aggregate, you can use an optional parameter that is called MAXIMUM MEMORY to specify the amount of memory, in bytes, that the function or aggregate is expected to require as it runs. The size value can be an empty value or a value in the form of a number, or a number with the letters b (bytes), k (kilobytes), m (megabytes), or g (gigabytes). This limit is not a memory limit threshold; instead, this value is a performance indicator that is used during scheduling and planning. The stated memory allocation helps the system to schedule the UDX better, which runs the queries that use the UDX more efficiently.

For each UDX, try to estimate the overall memory consumption and use the MAXIMUM MEMORY parameter to specify the total memory usage. The test harness (described in UDX test harness) provides information that can help you to assess the memory consumption of a UDX.

You can use the getMemory() function within your UDX to display the memory that the UDF or UDA registered with (its MAXIMUM MEMORY value).

API version 2 UDXs have access to the memory registration within the constructor.