確保済みメモリブロックのサイズ変更

Namespace: fvalgcli
Assembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)

Syntax

C#
public static IntPtr fnOAL_realloc(
	IntPtr vpOldPtr,
	SIZE_T tNewMemSize
)
Visual Basic
Public Shared Function fnOAL_realloc ( 
	vpOldPtr As IntPtr,
	tNewMemSize As SIZE_T
) As IntPtr

Parameters

vpOldPtr
Type: System..::..IntPtr
サイズを変更するメモリブロックへのポインタ
tNewMemSize
Type: fvalgcli..::..SIZE_T
新しいメモリブロックサイズ

Return Value

Type: IntPtr
正常に終了した場合には、新しいメモリブロックへのポインタを返します。 異常終了した場合には、IntPtr.Zero を返します。 解放する際は fnOAL_free(IntPtr) を使用してください。

Remarks

Examples

C# Copy imageCopy
//    $Revision: 1.1 $

using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        /// <summary>
        /// 確保済みメモリブロックのサイズ変更.
        /// </summary>
        [FvPluginExecute]
        public void fnOAL_realloc()
        {
            PNT_T_PTR mem = PNT_T_PTR.Zero;
            SIZE_T size = PNT_T_PTR.SizeOfItem * 1024;

            try
            {
                // 確保.
                mem = api.fnOAL_malloc(size);

                // 再確保.
                mem = api.fnOAL_realloc(mem, (size * 2));

                // エラー判定.
                Assert.IsTrue(mem != PNT_T_PTR.Zero, "fnOAL_realloc: エラーが発生しました。");
            }
            finally
            {
                // メモリブロックの開放.
                api.fnOAL_free(mem);
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

Public Partial Class FIE
    ''' <summary>
    ''' 確保済みメモリブロックのサイズ変更.
    ''' </summary>
    <FvPluginExecute> _
    Public Sub fnOAL_realloc()
        Dim mem As PNT_T_PTR = PNT_T_PTR.Zero
        Dim size As SIZE_T = PNT_T_PTR.SizeOfItem * 1024

        Try
            ' 確保.
            mem = api.fnOAL_malloc(size)

            ' 再確保.
            mem = api.fnOAL_realloc(mem, (size.ToInt32() * 2))

            ' エラー判定.
            Assert.IsTrue(mem <> PNT_T_PTR.Zero, "fnOAL_realloc: エラーが発生しました。")
        Finally
            ' メモリブロックの開放.
            api.fnOAL_free(mem)
        End Try
    End Sub
End Class

See Also