Using Magic_OpenFileInMemory. Memory management question.

All information about Magic Particles: news, question, comments, etc.

Using Magic_OpenFileInMemory. Memory management question.

Postby Nomad » Wed Aug 25, 2010 5:16 pm

Hello.

Will Magic_CloseFile() release the buffer which I pass to Magic_OpenFileInMemory()?

Memory management question is not covered in docs at all for Magic_OpenFileInMemory() function.

Thanks
Nomad
 
Posts: 7
Joined: Sat May 01, 2010 11:52 am

Re: Using Magic_OpenFileInMemory. Memory management question.

Postby Odin_KG » Wed Aug 25, 2010 6:25 pm

Hello

Will Magic_CloseFile() release the buffer which I pass to Magic_OpenFileInMemory()?

Magic_CloseFile() releases the buffer.

Memory management question is not covered in docs at all for Magic_OpenFileInMemory() function.

Ok. I will add this information in new version of the manual.
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm

Re: Using Magic_OpenFileInMemory. Memory management question.

Postby Odin_KG » Thu Aug 26, 2010 4:01 am

I am sorry. I did not understand question. Magic_CloseFile does not release the buffer. Magic_CloseFile releases information about file, which was loaded from this buffer. You need to use delete []buffer.
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm

Re: Using Magic_OpenFileInMemory. Memory management question.

Postby Nomad » Thu Aug 26, 2010 3:01 pm

hm..

I tried to delete[] buffer.
But it seems that it changes in some of Magic Particles API calls, because when I call delete[], my app either hangs or breaks on corrupted heap exception.

I will research this issue further to give you more information on this.
Nomad
 
Posts: 7
Joined: Sat May 01, 2010 11:52 am

Re: Using Magic_OpenFileInMemory. Memory management question.

Postby Nomad » Thu Aug 26, 2010 3:10 pm

Sorry.
That was my bug.
Now I'm releasing the buffer after Magic_CloseFile() call and all works just fine.
Thanks.
Nomad
 
Posts: 7
Joined: Sat May 01, 2010 11:52 am

Re: Using Magic_OpenFileInMemory. Memory management question.

Postby Odin_KG » Thu Aug 26, 2010 4:54 pm

Thanks.

You are welcome.
User avatar
Odin_KG
Administrator
Administrator
 
Posts: 255
Joined: Sat May 09, 2009 10:53 pm


Return to Magic Particles

Who is online

Users browsing this forum: No registered users and 7 guests

cron