{"id":5714,"date":"2019-02-27T17:19:11","date_gmt":"2019-02-28T01:19:11","guid":{"rendered":"https:\/\/www.coretechnologies.com\/blog\/?p=5714"},"modified":"2025-12-08T06:43:39","modified_gmt":"2025-12-08T14:43:39","slug":"vb6-memory-leaks","status":"publish","type":"post","link":"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/vb6-memory-leaks\/","title":{"rendered":"Q&#038;A: How do I Make AlwaysUp Babysit my &#8220;Leaky&#8221; VB6 Program?"},"content":{"rendered":"<div align=\"center\"><img decoding=\"async\" src=\"\/blog\/images\/qa-memory-leaks.png\" title=\"Q &#038; A - Memory leak\" alt=\"Q &#038; A - Memory leak\" border=\"0\" ><\/div>\n<div class=\"blog-qa-question-box\">\n<img decoding=\"async\" src=\"\/images\/quotes-transparent-21x21.png\">&nbsp;&nbsp;Our old <a href=\"https:\/\/en.wikipedia.org\/wiki\/Visual_Basic\" target=\"_blank\" rel=\"noopener noreferrer\">VB6<\/a> program leaks memory on every request and it can fail or crash multiple times a day. We need to re-write it but we don&#8217;t have budget right now so I&#8217;m looking at <a href=\"\/products\/AlwaysUp\/\">AlwaysUp<\/a> to run it all the time. What settings should I use to keep it running?<\/p>\n<p align=\"right\">&#8212; Anonymous<\/p>\n<\/div>\n<p>Hi. We have many customers who have turned to AlwaysUp to keep legacy applications going. Here is what we recommend for your situation:<\/p>\n<hr class=\"blog-section\">\n<div style=\"width:100%;margin-bottom:30px;\">\n<div style=\"margin:0px;float:right;\"><a href=\"#top\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cdn.coretechnologies.com\/images\/top.jpg\" border=\"0\" width=\"50\" height=\"18\" title=\"Go to the top\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<h2 class=\"blog-caption\">Restart your VB6 program on high memory use<\/h2>\n<p>AlwaysUp is designed to launch your application as a Windows Service when your computer boots, but it can perform several &#8220;monitoring tasks&#8221; after that initial event.<\/p>\n<p>One such task is to watch how much memory your application is using. You can setup AlwaysUp to stop and restart your application when its memory usage crosses a specific threshold.<\/p>\n<p>The setting is available on AlwaysUp&#8217;s Monitor tab:<\/p>\n<div align=\"center\"><a href=\"\/blog\/images\/alwaysup-monitor-tab-memory-threshold.png\" class=\"zoomPopup\" title=\"AlwaysUp Monitor tab - Memory setting\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"\/blog\/images\/alwaysup-monitor-tab-memory-threshold.png\" title=\"AlwaysUp Monitor tab - Memory setting (click to enlarge)\" alt=\"AlwaysUp Monitor tab - Memory setting\" border=\"0\" ><\/a><\/div>\n<p>The default threshold is 512 MB. Is that too much (or too little) for your VB6 application?<\/p>\n<p>We suggest using the Task Manager to get an idea of how much memory your application typically consumes. Use that information to set the threshold appropriately.<\/p>\n<p>Note: Because AlwaysUp is a 32-bit application, the maximum memory threshold you can set is 4 GB. You will have to configure the <a href=\"\/products\/AlwaysUp\/Plugins\/#CheckMemorySize64\">CheckMemorySize64 sanity check plugin<\/a> to exceed that limit. Please <a href=\"\/support\/\">get in touch<\/a> if you need help doing that.<\/p>\n<hr class=\"blog-section\">\n<div style=\"width:100%;margin-bottom:30px;\">\n<div style=\"margin:0px;float:right;\"><a href=\"#top\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/cdn.coretechnologies.com\/images\/top.jpg\" border=\"0\" width=\"50\" height=\"18\" title=\"Go to the top\" alt=\"\" \/><\/a><\/div>\n<\/div>\n<h2 class=\"blog-caption\">Preempt memory problems by restarting VB6 (or rebooting the PC) once per day<\/h2>\n<p>While restarting on high memory is a good safety net, it is unpredictable. Your customers may notice a brief interruption if a restart occurs at a busy time.<\/p>\n<p>Consider instead, a proactive daily restart &mdash; to flush the accumulated memory leaks and start your VB6 program afresh. With a clean slate, your application should run reliably for some time before the excessive leaks bog it down again.<\/p>\n<p>You can configure a daily restart on the Monitor tab as well. Here we have asked AlwaysUp to stop and restart the application every day at 2 AM:<\/p>\n<div align=\"center\"><a href=\"\/blog\/images\/alwaysup-monitor-tab-daily-restart.png\" class=\"zoomPopup\" title=\"AlwaysUp Monitor tab - Daily restart\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"\/blog\/images\/alwaysup-monitor-tab-daily-restart.png\" title=\"AlwaysUp Monitor tab - Daily restart (click to enlarge)\" alt=\"AlwaysUp Monitor tab - Daily restart\" border=\"0\" ><\/a><\/div>\n<p>Note that you can:<\/p>\n<ul>\n<li>Reboot the entire machine. This may be necessary if you find that restarting the application alone doesn&#8217;t clear the problems.<\/li>\n<li>Restart\/reboot only when certain conditions are met. For example, you can skip the restart if the application is busy (i.e. using CPU), or if it hasn&#8217;t used much memory yet.<\/li>\n<\/ul>\n<p>Whatever works for your situation!<\/p>\n<p>Want to restart your Visual Basic program more than once per day? <a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/restart-service-regularly\/\">This article<\/a> reviews some alternatives.<\/p>\n<p style=\"margin-top:32px;\">\nThose two settings should help. Best of luck with your application!<\/p>\n<!-- relpost-thumb-wrapper --><div class=\"relpost-thumb-wrapper\"><!-- filter-class --><div class=\"relpost-thumb-container\"><style>.relpost-block-single-image, .relpost-post-image { margin-bottom: 10px; }<\/style><h3>You may also like...<\/h3><div style=\"clear: both\"><\/div><div style=\"clear: both\"><\/div><!-- relpost-block-container --><div class=\"relpost-block-container relpost-block-column-layout\" style=\"--relposth-columns: 3;--relposth-columns_t: 2; --relposth-columns_m: 2\"><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/windows-service-vs-web-service\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q&amp;A: What&#039;s the difference between a Windows Service and a Web Service?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/windows-service-vs-web-service-150x150-1.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Q&amp;A: What&#039;s the difference between a Windows Service and a Web Service?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/software\/onedrive-slow-disable-files-on-demand\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"OneDrive\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/onedrive-logo-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">OneDrive Slow? Try Disabling Files On-Demand<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/onedrive-hates-admin-rights\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"OneDrive Can&#039;t Be Run Using Full Administrator Rights\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/no-admin-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">OneDrive Can&#039;t Be Run Using Full Administrator Rights<\/h2><\/div><\/div><\/a><\/div><!-- close relpost-block-container --><div style=\"clear: both\"><\/div><\/div><!-- close filter class --><\/div><!-- close relpost-thumb-wrapper -->","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;Our old VB6 program leaks memory on every request and it can fail or crash multiple times a day. We need to re-write it but we don&#8217;t have budget right now so I&#8217;m looking at AlwaysUp to run it all &hellip; <a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/vb6-memory-leaks\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":6386,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[26,103,127,161,174],"class_list":["post-5714","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-alwaysup","tag-alwaysup-tag","tag-memory-leaks","tag-qa","tag-product-support","tag-vb6"],"_links":{"self":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/5714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=5714"}],"version-history":[{"count":2,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/5714\/revisions"}],"predecessor-version":[{"id":13274,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/5714\/revisions\/13274"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media\/6386"}],"wp:attachment":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=5714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=5714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=5714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}