[Iup-users] Memory question again.
Antonio Scuri
scuri at tecgraf.puc-rio.br
Tue Nov 6 15:23:22 GMT+3 2007
The IupSetAttribute just keeps a reference to the given pointer. So the
memory will not be freed.
The IupStoreAttribute will duplicate the given string. So you can free it
just after the call.
The code as it is, will result in a memory leak.
Best,
scuri
> -----Original Message-----
> From: iup-users-bounces at lists.luaforge.net
> [mailto:iup-users-bounces at lists.luaforge.net] On Behalf Of
> Jeremy Cowgar
> Sent: terça-feira, 6 de novembro de 2007 16:11
> To: IUP discussion list.
> Subject: [Iup-users] Memory question again.
>
> Let's say I do this:
>
> void doSomething ()
> {
> char *value = malloc (sizeof (char) * 10);
> strcpy (value, "HELLO");
> IupSetAttribute (textWidget, IUP_VALUE, value); }
>
>
> So, I call doSomething() somewhere in my code. Later, I call
> it again.
> Does Iup free the memory before setting the attribute again?
>
> Jeremy
>
>
>
>
> _______________________________________________
> iup-users mailing list
> iup-users at lists.luaforge.net
> http://lists.luaforge.net/cgi-bin/mailman/listinfo/iup-users
>
More information about the iup-users
mailing list