アライメントされたメモリブロックの割当
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static IntPtr fnOAL_aligned_malloc(
SIZE_T sz,
int align
) |
Visual Basic |
---|
Public Shared Function fnOAL_aligned_malloc (
sz As SIZE_T,
align As Integer
) As IntPtr |
Parameters
- sz
- Type: fvalgcli..::..SIZE_T
割り当てるバイト数
- align
- Type: System..::..Int32
アライメント位置。2の累乗値を指定して下さい。(2,4,8,16...)
Return Value
Type:
IntPtr
正常に終了した場合は、割り当てられたメモリブロックへのポインタを返します。
align の値が2の累乗値で無い場合は IntPtr.Zero を返します。
メモリ不足などで、異常終了した場合には IntPtr.Zero を返します。
解放する際は
fnOAL_aligned_free(IntPtr) を使用してください。
Remarks
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnOAL_aligned_malloc()
{
SHORT_PTR mem = SHORT_PTR.Zero;
SIZE_T size = SHORT_PTR.SizeOfItem * 1024;
int align = 8;
try
{
mem = api.fnOAL_aligned_malloc(size, align);
Assert.IsTrue(mem != SHORT_PTR.Zero, "fnOAL_aligned_malloc: エラーが発生しました。");
}
finally
{
api.fnOAL_aligned_free(mem);
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnOAL_aligned_malloc()
Dim mem As SHORT_PTR = SHORT_PTR.Zero
Dim size As SIZE_T = SHORT_PTR.SizeOfItem * 1024
Dim align As Integer = 8
Try
mem = api.fnOAL_aligned_malloc(size, align)
Assert.IsTrue(mem <> SHORT_PTR.Zero, "fnOAL_aligned_malloc: エラーが発生しました。")
Finally
api.fnOAL_aligned_free(mem)
End Try
End Sub
End Class |
See Also