O
oocoolie
Unregistered / Unconfirmed
GUEST, unregistred user!
有一个指针数组,数组中的每一个指针指向一个结构
type
pChannel=^channel;
Channel=record
Cindex:integer;
operation:string[20];
channelname:string[50];
description:string[200];
ip:string[20];
port:integer;
localip:string[20];
workdir:string[200];
BitRate:integer;
FECRatio:integer;
Sendtimes:integer;
enabled:integer;
ChannelType:integer;
SendFilelist:integer;
end;
var
m_Channels:array of PChannel;
setlength(m_Channels,10);
for i:=0 to 9 do
getmem(m_Channels,sizeof(Channel));
请问怎样完全释放这个动态数组的内存?
下面的代码恰当吗?
for i:=0 to length(m_channels)-1 do
freemem(m_channels);
setlength(m_channels,0);
btw:如果定义结构时我不固定string的大小,则sizeof返回的结构大小为56,并且给string
字段赋值出错,请问默认的编译器给string定义的大小是?
type
pChannel=^channel;
Channel=record
Cindex:integer;
operation:string[20];
channelname:string[50];
description:string[200];
ip:string[20];
port:integer;
localip:string[20];
workdir:string[200];
BitRate:integer;
FECRatio:integer;
Sendtimes:integer;
enabled:integer;
ChannelType:integer;
SendFilelist:integer;
end;
var
m_Channels:array of PChannel;
setlength(m_Channels,10);
for i:=0 to 9 do
getmem(m_Channels,sizeof(Channel));
请问怎样完全释放这个动态数组的内存?
下面的代码恰当吗?
for i:=0 to length(m_channels)-1 do
freemem(m_channels);
setlength(m_channels,0);
btw:如果定义结构时我不固定string的大小,则sizeof返回的结构大小为56,并且给string
字段赋值出错,请问默认的编译器给string定义的大小是?