-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for custom memory allocation (Sdk.SetCustomMemoryAllocator me…
…thod)
- Loading branch information
Showing
4 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
|
||
namespace K4AdotNet | ||
{ | ||
/// <summary> | ||
/// Base interface for custom memory manager that can be used to allocate and free memory used by images. | ||
/// </summary> | ||
/// <seealso cref="Sdk.SetCustomMemoryAllocator(ICustomMemoryAllocator?)"/> | ||
public interface ICustomMemoryAllocator | ||
{ | ||
/// <summary>Function for a memory allocation. Will be called by internals of Azure Kinect SDK.</summary> | ||
/// <param name="size">Minimum size in bytes needed for the buffer.</param> | ||
/// <param name="context">Output parameter for a context that will be provided in the subsequent call to the <see cref="Free(IntPtr, IntPtr)"/> callback.</param> | ||
/// <returns>A pointer to the newly allocated memory.</returns> | ||
IntPtr Allocate(int size, out IntPtr context); | ||
|
||
/// <summary>Function for a memory object being destroyed. Will be called by internals of Azure Kinect SDK.</summary> | ||
/// <param name="buffer">The buffer pointer that was supplied by the <see cref="Allocate(int, out IntPtr)"/> method and that should be free.</param> | ||
/// <param name="context">The context for the memory object that needs to be destroyed that was supplied by the <see cref="Allocate(int, out IntPtr)"/> method.</param> | ||
void Free(IntPtr buffer, IntPtr context); | ||
} | ||
} |
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
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