Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Out of Memory Problem driving me crazy


Reply
 
Thread Tools Display Modes
  #1  
Old 09-03-2003, 04:29 PM
fnastro fnastro is offline
Newcomer
 
Join Date: Sep 2003
Posts: 1
Angry Out of Memory Problem driving me crazy


Ok here is the problem:

Below is the code that is giving me trouble. I have a global array delared to hold the information. The array is of type

Type PrintItems
BeginBates As String
EndBates As String
EmailNumber As Long
HasDuplicate As Boolean
DuplicateOf As String
foldername As String
ItemType As String
emailItem As outlook.MailItem
AttachemntFilename As String
to As String
from As String
cc As String
bcc As String
sentdate As String
subject As String
End Type

The code that is causing the Out of Memory errors is

----------------------------------------------------------

TotalEmails = TotalEmails + 1
PrintItemArray(x).EmailNumber = TotalEmails
PrintItemArray(x).DuplicateOf = PrintItemArray(DuplicateEmailNumber).EmailNumber
PrintItemArray(x).foldername = thefolder
PrintItemArray(x).ItemType = "Email"

Set PrintItemArray(x).emailItem = objitem

PrintItemArray(x).AttachemntFilename = ""
PrintItemArray(x).to = objitem.to
PrintItemArray(x).from = objitem.SenderName
PrintItemArray(x).cc = objitem.cc
PrintItemArray(x).bcc = objitem.bcc
PrintItemArray(x).sentdate = objitem.SentOn
PrintItemArray(x).subject = objitem.subject
-----------------------------------------------------------

I know this is where the problem is because if I comment out the
Set PrintItemArray(x).emailItem = objitem
line everything runs fine.
Now according to the SET statement description if i use SET without NEW then I should not be allocating memory but simply pointing to the object. The Procedure declaration is:

Sub AddEmailToDatabase(thefolder As String, objitem As outlook.MailItem)

Does anyone have any Ideas????

Frank J Nastro
Reply With Quote
  #2  
Old 09-03-2003, 05:04 PM
VB-Nerd's Avatar
VB-Nerd VB-Nerd is offline
Regular
 
Join Date: Jul 2003
Location: Colorado
Posts: 95
Smile

I'm taking it that you re-create that Object multiple times and your expecting it to be destroyed when it goes of of scope....if so Try unloading the Object in your loop.

Does it fail on the first loop?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
memory problem with internet controls Darthy General 2 07-16-2003 07:51 AM
Memory problem / large strings kohli_vie General 19 04-06-2003 06:19 AM
GlobalAlloc - Type definition - memory problem? _Mark_ General 6 03-08-2003 12:02 PM
Memory problem hunter2002 General 15 01-14-2003 11:05 AM
Big Bad memory problem. pauldunbar General 2 03-07-2002 09:04 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->