Managing LOH in vb.netWhat is the difference between And and AndAlso in VB.NET?Is there a conditional ternary operator in VB.NET?Multiline strings in VB.NETClasses vs. Modules in VB.NETHow to insert values into VB.NET Dictionary on instantiation?What is the VB.NET equivalent of the C# “is” keyword?Is there a VB.NET equivalent of C# out parameters?LOH internals wantedEntity Framework, binary data and LOHLOH benchmarking using benchmarkdotnet
Semantic difference between regular and irregular 'backen'
Anyone else seeing white rings in the Undead parish?
Does this VCO produce a sine wave or square wave
How can I reorder triggered abilities in Arena?
How many birds in the bush?
Expressing the act of drawing
Ghidra: Prepend memory segment in assembly listing view
Movie where people enter a church but find they can't leave, not in English
How many lines of code does the original TeX contain?
When calculating a force, why do I get different result when I try to calculate via torque vs via sum of forces at an axis?
Could this kind of inaccurate sacrifice be countered?
about to retire but not retired yet, employed but not working any more
Talk interpreter
Are game port joystick buttons ever more than plain switches? Is this one just faulty?
Redacting URLs as an email-phishing preventative?
Prison offence - trespassing underwood fence
Can $! cause race conditions when used in scripts running in parallel?
How to maximize the drop odds of the Essences in Diablo II?
Why is the UK so keen to remove the "backstop" when their leadership seems to think that no border will be needed in Northern Ireland?
Why are non-collision-resistant hash functions considered insecure for signing self-generated information
Do Bayesian credible intervals treat the estimated parameter as a random variable?
Server Integrity Check CheckCommands question
Was the Boeing 2707 design flawed?
Discussing work with supervisor in an invited dinner with his family
Managing LOH in vb.net
What is the difference between And and AndAlso in VB.NET?Is there a conditional ternary operator in VB.NET?Multiline strings in VB.NETClasses vs. Modules in VB.NETHow to insert values into VB.NET Dictionary on instantiation?What is the VB.NET equivalent of the C# “is” keyword?Is there a VB.NET equivalent of C# out parameters?LOH internals wantedEntity Framework, binary data and LOHLOH benchmarking using benchmarkdotnet
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have an vb.net application I distribute to my analysts – We assign perhaps 100 200MB images at a time. The app sequentially opens the large jpg image using GDI+ and the image is placed in the LOH. I scan each pixel looking for data. - when done I dispose the image and use GC.collect. But this does not clear the LOH, and as a result the LOH keeps increasing until the app crashes. A work around is to chop the assignment into 25 instance chunks, but this is risky as our analysts often do this late at night – perhaps after a beer or 2.
The C# construct is
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce
but there is no GCSettings available in vb.net
My vb.net code is
loadedImage.Dispose()
MasterImage.Dispose()
GC.Collect()
Finalize()
But I cannot find a vb.net method to force the LOH compaction
When done
Can you help?
vb.net c#-to-vb.net large-object-heap
add a comment |
I have an vb.net application I distribute to my analysts – We assign perhaps 100 200MB images at a time. The app sequentially opens the large jpg image using GDI+ and the image is placed in the LOH. I scan each pixel looking for data. - when done I dispose the image and use GC.collect. But this does not clear the LOH, and as a result the LOH keeps increasing until the app crashes. A work around is to chop the assignment into 25 instance chunks, but this is risky as our analysts often do this late at night – perhaps after a beer or 2.
The C# construct is
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce
but there is no GCSettings available in vb.net
My vb.net code is
loadedImage.Dispose()
MasterImage.Dispose()
GC.Collect()
Finalize()
But I cannot find a vb.net method to force the LOH compaction
When done
Can you help?
vb.net c#-to-vb.net large-object-heap
Not possible if targeting < 4.5.1, also should you be using compaction...
– Çöđěxěŕ
Mar 27 at 20:17
If you don't want to use a memory profiler then you just need more beer. Project > Properties > Compile tab > untick the "Prefer 32-bit" checkbox.
– Hans Passant
Mar 27 at 22:20
Hi and thanks - I do have t32-bit unchecked, now on .net 4.6.1 I like memory profiling better than beer, so 2 snapshots at some distance from each other showed almost no change in heap sizes but the process memory went from 681MB to 15.3 GB - so about 350MB per image is not released back to the system. I will try adding a 'Finally to the single try/catch block, but the catch is never used. Looking at GC not releasing . . . topic now
– Rfrank
Mar 28 at 20:20
add a comment |
I have an vb.net application I distribute to my analysts – We assign perhaps 100 200MB images at a time. The app sequentially opens the large jpg image using GDI+ and the image is placed in the LOH. I scan each pixel looking for data. - when done I dispose the image and use GC.collect. But this does not clear the LOH, and as a result the LOH keeps increasing until the app crashes. A work around is to chop the assignment into 25 instance chunks, but this is risky as our analysts often do this late at night – perhaps after a beer or 2.
The C# construct is
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce
but there is no GCSettings available in vb.net
My vb.net code is
loadedImage.Dispose()
MasterImage.Dispose()
GC.Collect()
Finalize()
But I cannot find a vb.net method to force the LOH compaction
When done
Can you help?
vb.net c#-to-vb.net large-object-heap
I have an vb.net application I distribute to my analysts – We assign perhaps 100 200MB images at a time. The app sequentially opens the large jpg image using GDI+ and the image is placed in the LOH. I scan each pixel looking for data. - when done I dispose the image and use GC.collect. But this does not clear the LOH, and as a result the LOH keeps increasing until the app crashes. A work around is to chop the assignment into 25 instance chunks, but this is risky as our analysts often do this late at night – perhaps after a beer or 2.
The C# construct is
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce
but there is no GCSettings available in vb.net
My vb.net code is
loadedImage.Dispose()
MasterImage.Dispose()
GC.Collect()
Finalize()
But I cannot find a vb.net method to force the LOH compaction
When done
Can you help?
vb.net c#-to-vb.net large-object-heap
vb.net c#-to-vb.net large-object-heap
edited Mar 27 at 19:33
J...
25.5k5 gold badges53 silver badges115 bronze badges
25.5k5 gold badges53 silver badges115 bronze badges
asked Mar 27 at 19:24
RfrankRfrank
163 bronze badges
163 bronze badges
Not possible if targeting < 4.5.1, also should you be using compaction...
– Çöđěxěŕ
Mar 27 at 20:17
If you don't want to use a memory profiler then you just need more beer. Project > Properties > Compile tab > untick the "Prefer 32-bit" checkbox.
– Hans Passant
Mar 27 at 22:20
Hi and thanks - I do have t32-bit unchecked, now on .net 4.6.1 I like memory profiling better than beer, so 2 snapshots at some distance from each other showed almost no change in heap sizes but the process memory went from 681MB to 15.3 GB - so about 350MB per image is not released back to the system. I will try adding a 'Finally to the single try/catch block, but the catch is never used. Looking at GC not releasing . . . topic now
– Rfrank
Mar 28 at 20:20
add a comment |
Not possible if targeting < 4.5.1, also should you be using compaction...
– Çöđěxěŕ
Mar 27 at 20:17
If you don't want to use a memory profiler then you just need more beer. Project > Properties > Compile tab > untick the "Prefer 32-bit" checkbox.
– Hans Passant
Mar 27 at 22:20
Hi and thanks - I do have t32-bit unchecked, now on .net 4.6.1 I like memory profiling better than beer, so 2 snapshots at some distance from each other showed almost no change in heap sizes but the process memory went from 681MB to 15.3 GB - so about 350MB per image is not released back to the system. I will try adding a 'Finally to the single try/catch block, but the catch is never used. Looking at GC not releasing . . . topic now
– Rfrank
Mar 28 at 20:20
Not possible if targeting < 4.5.1, also should you be using compaction...
– Çöđěxěŕ
Mar 27 at 20:17
Not possible if targeting < 4.5.1, also should you be using compaction...
– Çöđěxěŕ
Mar 27 at 20:17
If you don't want to use a memory profiler then you just need more beer. Project > Properties > Compile tab > untick the "Prefer 32-bit" checkbox.
– Hans Passant
Mar 27 at 22:20
If you don't want to use a memory profiler then you just need more beer. Project > Properties > Compile tab > untick the "Prefer 32-bit" checkbox.
– Hans Passant
Mar 27 at 22:20
Hi and thanks - I do have t32-bit unchecked, now on .net 4.6.1 I like memory profiling better than beer, so 2 snapshots at some distance from each other showed almost no change in heap sizes but the process memory went from 681MB to 15.3 GB - so about 350MB per image is not released back to the system. I will try adding a 'Finally to the single try/catch block, but the catch is never used. Looking at GC not releasing . . . topic now
– Rfrank
Mar 28 at 20:20
Hi and thanks - I do have t32-bit unchecked, now on .net 4.6.1 I like memory profiling better than beer, so 2 snapshots at some distance from each other showed almost no change in heap sizes but the process memory went from 681MB to 15.3 GB - so about 350MB per image is not released back to the system. I will try adding a 'Finally to the single try/catch block, but the catch is never used. Looking at GC not releasing . . . topic now
– Rfrank
Mar 28 at 20:20
add a comment |
1 Answer
1
active
oldest
votes
GCSettings.LargeObjectHeapCompactionMode
was added in .NET 4.5.1. It exists in VB.NET as well as C#. You're probably targeting a lower version of the .NET runtime. If you want access to this feature you will need to compile against a framework version of 4.5.1 or higher.
This likely won't solve the underlying problem, however. Your leak may not even be where you think it is. Profiling your application with an allocation profiler is the best way to track down resource leaks. Without a Minimal, Complete, and Verifiable example, it is difficult to guess where your application may be going wrong.
Hi and thanks - I was using the v4.0 which was available in 2007 when i first wrote the app, I went to 4.6.1 and found the GCSettings and used it in a runtime construct - it runs - but is not solving the problem. For testing - i have a 4 image set - so I will expand the data set to a full production run and retest. It is possible I do not understand the issue . Is there a way to see the contents of memory by variable name?
– Rfrank
Mar 27 at 20:59
@Rfrank I think that's a topic for a follow-up question. See : What is the the best way to ask follow up questions?
– J...
Mar 27 at 22:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385034%2fmanaging-loh-in-vb-net%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
GCSettings.LargeObjectHeapCompactionMode
was added in .NET 4.5.1. It exists in VB.NET as well as C#. You're probably targeting a lower version of the .NET runtime. If you want access to this feature you will need to compile against a framework version of 4.5.1 or higher.
This likely won't solve the underlying problem, however. Your leak may not even be where you think it is. Profiling your application with an allocation profiler is the best way to track down resource leaks. Without a Minimal, Complete, and Verifiable example, it is difficult to guess where your application may be going wrong.
Hi and thanks - I was using the v4.0 which was available in 2007 when i first wrote the app, I went to 4.6.1 and found the GCSettings and used it in a runtime construct - it runs - but is not solving the problem. For testing - i have a 4 image set - so I will expand the data set to a full production run and retest. It is possible I do not understand the issue . Is there a way to see the contents of memory by variable name?
– Rfrank
Mar 27 at 20:59
@Rfrank I think that's a topic for a follow-up question. See : What is the the best way to ask follow up questions?
– J...
Mar 27 at 22:04
add a comment |
GCSettings.LargeObjectHeapCompactionMode
was added in .NET 4.5.1. It exists in VB.NET as well as C#. You're probably targeting a lower version of the .NET runtime. If you want access to this feature you will need to compile against a framework version of 4.5.1 or higher.
This likely won't solve the underlying problem, however. Your leak may not even be where you think it is. Profiling your application with an allocation profiler is the best way to track down resource leaks. Without a Minimal, Complete, and Verifiable example, it is difficult to guess where your application may be going wrong.
Hi and thanks - I was using the v4.0 which was available in 2007 when i first wrote the app, I went to 4.6.1 and found the GCSettings and used it in a runtime construct - it runs - but is not solving the problem. For testing - i have a 4 image set - so I will expand the data set to a full production run and retest. It is possible I do not understand the issue . Is there a way to see the contents of memory by variable name?
– Rfrank
Mar 27 at 20:59
@Rfrank I think that's a topic for a follow-up question. See : What is the the best way to ask follow up questions?
– J...
Mar 27 at 22:04
add a comment |
GCSettings.LargeObjectHeapCompactionMode
was added in .NET 4.5.1. It exists in VB.NET as well as C#. You're probably targeting a lower version of the .NET runtime. If you want access to this feature you will need to compile against a framework version of 4.5.1 or higher.
This likely won't solve the underlying problem, however. Your leak may not even be where you think it is. Profiling your application with an allocation profiler is the best way to track down resource leaks. Without a Minimal, Complete, and Verifiable example, it is difficult to guess where your application may be going wrong.
GCSettings.LargeObjectHeapCompactionMode
was added in .NET 4.5.1. It exists in VB.NET as well as C#. You're probably targeting a lower version of the .NET runtime. If you want access to this feature you will need to compile against a framework version of 4.5.1 or higher.
This likely won't solve the underlying problem, however. Your leak may not even be where you think it is. Profiling your application with an allocation profiler is the best way to track down resource leaks. Without a Minimal, Complete, and Verifiable example, it is difficult to guess where your application may be going wrong.
edited Mar 27 at 22:06
answered Mar 27 at 19:38
J...J...
25.5k5 gold badges53 silver badges115 bronze badges
25.5k5 gold badges53 silver badges115 bronze badges
Hi and thanks - I was using the v4.0 which was available in 2007 when i first wrote the app, I went to 4.6.1 and found the GCSettings and used it in a runtime construct - it runs - but is not solving the problem. For testing - i have a 4 image set - so I will expand the data set to a full production run and retest. It is possible I do not understand the issue . Is there a way to see the contents of memory by variable name?
– Rfrank
Mar 27 at 20:59
@Rfrank I think that's a topic for a follow-up question. See : What is the the best way to ask follow up questions?
– J...
Mar 27 at 22:04
add a comment |
Hi and thanks - I was using the v4.0 which was available in 2007 when i first wrote the app, I went to 4.6.1 and found the GCSettings and used it in a runtime construct - it runs - but is not solving the problem. For testing - i have a 4 image set - so I will expand the data set to a full production run and retest. It is possible I do not understand the issue . Is there a way to see the contents of memory by variable name?
– Rfrank
Mar 27 at 20:59
@Rfrank I think that's a topic for a follow-up question. See : What is the the best way to ask follow up questions?
– J...
Mar 27 at 22:04
Hi and thanks - I was using the v4.0 which was available in 2007 when i first wrote the app, I went to 4.6.1 and found the GCSettings and used it in a runtime construct - it runs - but is not solving the problem. For testing - i have a 4 image set - so I will expand the data set to a full production run and retest. It is possible I do not understand the issue . Is there a way to see the contents of memory by variable name?
– Rfrank
Mar 27 at 20:59
Hi and thanks - I was using the v4.0 which was available in 2007 when i first wrote the app, I went to 4.6.1 and found the GCSettings and used it in a runtime construct - it runs - but is not solving the problem. For testing - i have a 4 image set - so I will expand the data set to a full production run and retest. It is possible I do not understand the issue . Is there a way to see the contents of memory by variable name?
– Rfrank
Mar 27 at 20:59
@Rfrank I think that's a topic for a follow-up question. See : What is the the best way to ask follow up questions?
– J...
Mar 27 at 22:04
@Rfrank I think that's a topic for a follow-up question. See : What is the the best way to ask follow up questions?
– J...
Mar 27 at 22:04
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55385034%2fmanaging-loh-in-vb-net%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Not possible if targeting < 4.5.1, also should you be using compaction...
– Çöđěxěŕ
Mar 27 at 20:17
If you don't want to use a memory profiler then you just need more beer. Project > Properties > Compile tab > untick the "Prefer 32-bit" checkbox.
– Hans Passant
Mar 27 at 22:20
Hi and thanks - I do have t32-bit unchecked, now on .net 4.6.1 I like memory profiling better than beer, so 2 snapshots at some distance from each other showed almost no change in heap sizes but the process memory went from 681MB to 15.3 GB - so about 350MB per image is not released back to the system. I will try adding a 'Finally to the single try/catch block, but the catch is never used. Looking at GC not releasing . . . topic now
– Rfrank
Mar 28 at 20:20