Impact of Gen-AI on IT Jobs - Growth Mindset Show
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
4
Reply
How to release managed memory in C#
Jorge L Fernandez
17y
10.2k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
garbage collect
jiya baraiya
17y
0
I got into the AppDomain benefits an implemented another solution to the initial problem; - Create an AppDomain. - Executing the Assembly into the created domain. - Unload the domain. Both solutions are equivalent in terms of performance and memory. Anyways, if some other approach are possible I will appreciate your comments.
Jorge L Fernandez
17y
0
I realized that my problem was that many Bitmap object were created through the process. I invoked the GC.Collect method but this was causing a performance impact. Then I start looking for a solution to release by my self those Bitmap. Bitmap are created in the managed heap which is not intended to be accessed directly by the user (coder), so, the solution I found was not elegant but solved my problem with no performance impact. I created a separated program that creates the Bitmaps and is called by the main program by using the Process class. When this separated program starts it does its work and then when is closed its occupied memory is released avoiding the OutOfMemoryException. If you have any suggestion or any other solution I will appreciate your response.
Jorge L Fernandez
17y
0
Hi, I'm creating a big amount of images at runtime (thousands) and I'm getting and OutOfMemory Exception. I have detected in my code where the problem is and it's an array of bytes that is being created many times and allocating memory until the GC do its work. How do I explicitly can free that byte array in order to avoid calling GC.Collect method? Thanks in advanced
Jorge L Fernandez
17y
0
Message