PDA

View Full Version : Free memory with dotnet drawing bitmap


david429
04-29-2009, 02:45 PM
Thanks for help

I have another question about How to Free memory with dotnet drawing bitmap

when after drawing many pictures with dotnet , that will show me
runtime error: dotNet runtime exception
about memory not enough

does anyone know how to free the dotnet using memory ?

I have tried "freesceneBitmap()" but not work

(
local bmpDisplayed = dotNetObject "System.Drawing.Bitmap" "c:\test.dds"
local bmpRectangle = dotNetObject "System.Drawing.Rectangle" 0 0 512 512

rollout uiDotNetPictureBox ".NET PictureBox" width:512 height:512
(
dotNetControl uiPictureBox "System.Windows.Forms.PictureBox" pos:[0,0] width:320 height:240

on uiPictureBox Paint senderArg paintEventArgs do
(
Graphics = paintEventArgs.Graphics
Graphics.DrawImage bmpDisplayed bmpRectangle
)
)

try(destroyDialog uiDotNetPictureBox) catch()
createdialog uiDotNetPictureBox style:#(#style_titlebar, #style_border, #style_sysmenu)
)

Kameleon
04-29-2009, 04:07 PM
Hey David, have you tried this?

dgc = dotnetclass "system.gc"
dgc.collect()

david429
04-29-2009, 04:16 PM
hello art ,I have no idea how to use the code
I've try run the code , but it show me "undefined"
and seems like did not free the memory

I'm Noob with maxscript and dotnet




dgc = dotnetclass "system.gc"

dgc.collect()





Thank you !

Kameleon
04-29-2009, 04:22 PM
That's it, anyway I was having the same problem with pictureboxes that's why I've wrote a kustom class either way it eats alot of memory, one thing I've noticed is that when you minimize max and restore it again, it solves the issue :D

CGTalk Moderation
04-29-2009, 04:22 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.