internal static extern JsErrorCode JsSetRuntimeMemoryAllocationCallback(JsRuntime runtime, IntPtr callbackState, JsMemoryAllocationCallback allocationCallback);
/// <summary> /// Sets a memory allocation callback for specified runtime /// </summary> /// <remarks> /// <para> /// Registering a memory allocation callback will cause the runtime to call back to the host /// whenever it acquires memory from, or releases memory to, the OS. The callback routine is /// called before the runtime memory manager allocates a block of memory. The allocation will /// be rejected if the callback returns false. The runtime memory manager will also invoke the /// callback routine after freeing a block of memory, as well as after allocation failures. /// </para> /// <para> /// The callback is invoked on the current runtime execution thread, therefore execution is /// blocked until the callback completes. /// </para> /// <para> /// The return value of the callback is not stored; previously rejected allocations will not /// prevent the runtime from invoking the callback again later for new memory allocations. /// </para> /// </remarks> /// <param name="callbackState"> /// User provided state that will be passed back to the callback. /// </param> /// <param name="allocationCallback"> /// Memory allocation callback to be called for memory allocation events. /// </param> public void SetMemoryAllocationCallback(IntPtr callbackState, JsMemoryAllocationCallback allocationCallback) { JsErrorHelpers.ThrowIfError(NativeMethods.JsSetRuntimeMemoryAllocationCallback(this, callbackState, allocationCallback)); }
internal static extern JsErrorCode JsSetRuntimeMemoryAllocationCallback(EdgeJsRuntime runtime, IntPtr callbackState, JsMemoryAllocationCallback allocationCallback);
/// <summary> /// Sets a memory allocation callback for specified runtime /// </summary> /// <remarks> /// <para> /// Registering a memory allocation callback will cause the runtime to call back to the host /// whenever it acquires memory from, or releases memory to, the OS. The callback routine is /// called before the runtime memory manager allocates a block of memory. The allocation will /// be rejected if the callback returns false. The runtime memory manager will also invoke the /// callback routine after freeing a block of memory, as well as after allocation failures. /// </para> /// <para> /// The callback is invoked on the current runtime execution thread, therefore execution is /// blocked until the callback completes. /// </para> /// <para> /// The return value of the callback is not stored; previously rejected allocations will not /// prevent the runtime from invoking the callback again later for new memory allocations. /// </para> /// </remarks> /// <param name="callbackState"> /// User provided state that will be passed back to the callback /// </param> /// <param name="allocationCallback"> /// Memory allocation callback to be called for memory allocation events /// </param> public void SetMemoryAllocationCallback(IntPtr callbackState, JsMemoryAllocationCallback allocationCallback) { IeJsErrorHelpers.ThrowIfError(IeNativeMethods.JsSetRuntimeMemoryAllocationCallback(this, callbackState, allocationCallback)); }
/// <summary> /// Sets a memory allocation callback for specified runtime /// </summary> /// <remarks> /// <para> /// Registering a memory allocation callback will cause the runtime to call back to the host /// whenever it acquires memory from, or releases memory to, the OS. The callback routine is /// called before the runtime memory manager allocates a block of memory. The allocation will /// be rejected if the callback returns false. The runtime memory manager will also invoke the /// callback routine after freeing a block of memory, as well as after allocation failures. /// </para> /// <para> /// The callback is invoked on the current runtime execution thread, therefore execution is /// blocked until the callback completes. /// </para> /// <para> /// The return value of the callback is not stored; previously rejected allocations will not /// prevent the runtime from invoking the callback again later for new memory allocations. /// </para> /// </remarks> /// <param name="callbackState"> /// User provided state that will be passed back to the callback. /// </param> /// <param name="allocationCallback"> /// Memory allocation callback to be called for memory allocation events. /// </param> public void SetMemoryAllocationCallback(IntPtr callbackState, JsMemoryAllocationCallback allocationCallback) { Native.ThrowIfError(Native.JsSetRuntimeMemoryAllocationCallback(this, callbackState, allocationCallback)); }