OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Memory Leaks (http://forum.oberonplace.com/showthread.php?t=24664)

VyperOne 24-03-2014 07:01

Memory Leaks
I currently develop an application in VB.NET and in one part of the app it repeats a find and replace. The method used is CorelDRAW.Page.TextReplace

After each iteration I can see via Task Manager memory being consumed by this method.

Unfortunately closing the document after the process has completed does not release the memory thereby requiring the user to close CorelDRAW completely to reacquire the spent memory.

Since I can clearly see the issue is with the method itself and not in my code I am posting this here in the hopes someone from Corel could address it.

You can replicate this by simply putting the method in a loop, like below:
(Make sure you have one line of text on your page with the number zero as the text)


    Sub ProveMemoryLoss()
        Dim iFindString As String = ""
        Dim iCounter As Integer = 0
        Dim CorelPage As CorelDRAW.Page
        Dim cApplication As CorelDRAW.Application
        cApplication = New CorelDRAW.Application
        CorelPage = cApplication.ActiveDocument.ActivePage

        For iCounter = 1 To 10000
            CorelPage.TextReplace((iCounter - 1).ToString, iCounter.ToString, False)

    End Sub

This problem isn't a big deal when you are only using it a few times but when you have a customer using it to produce 500 to 1000 lines of text it make Corel unstable on low memory hardware.

Any comments or suggestions welcomed. What I need is a way to get this fixed by Corel...

ddonnahoe 25-03-2014 07:22

I'd be interested to hear what is going on here as well.

SteveDude 26-03-2014 09:59

I think this may be part of the problem...


        cApplication = New CorelDRAW.Application

You shouldn't use New and that should go in the constructor. You might also try setting...


        cApplication = Nothing

... on exit.

All times are GMT -5. The time now is 11:04.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com