Giter Site home page Giter Site logo

Comments (9)

iseahound avatar iseahound commented on September 21, 2024 1

Fixed by af2bca4 44a25c8 and 2fbc4fe.

from imageput.

iseahound avatar iseahound commented on September 21, 2024

Is there a typo in your copy of ImagePut?

Line 1362 should read GlobalLock, not GlobalAlloc.

See:

pData := DllCall("GlobalLock", "ptr", hData, "ptr")

from imageput.

jpuerj avatar jpuerj commented on September 21, 2024

Sorry, that's a typo in the topic, the file is correct! Going to edit it!

from imageput.

iseahound avatar iseahound commented on September 21, 2024

Can you check for a memory leak? It looks like one to me. See how much memory AutoHotkey is using in task manager - it should be stable.

Also can you post the full code? Are you deleting 'img'?

from imageput.

iseahound avatar iseahound commented on September 21, 2024

Also,

ImagePutBuffer("window")

is ambiguous syntax try:

ImagePutBuffer({window: "MyTitle"})

to avoid the bug where a file name has the same name as a window

from imageput.

jpuerj avatar jpuerj commented on September 21, 2024

Can you check for a memory leak?

It increased 10MB in the last 3 minutes, I'm going to keep an eye on it. I had discarded this possibility earlier because when I got a leak in the past it would crash very early. EDIT: look's like a leak, it increased 30MB since writting this post.

Are you deleting 'img'?

I'm not deleting image. I thought it was not needed because it's inside a class method.

Also can you post the full code?

Sure: script.zip

I'm going to try deleting 'img' and every related object. I just need img := "", right?

Thanks!

from imageput.

iseahound avatar iseahound commented on September 21, 2024

Well this doesn't look like an ImagePut error.

Try to improve your memory management:

fn(img) {
    filepath := "something.png"
    static search := Imageputbuffer(filepath)
    img.imagesearch(search)
}

Make the search images static so you don't create a million of them. Then I see you're storing the screen capture in an array, you'll need to do arr[123] := "" to delete them. (Don't bother deleting static images they will be cleaned on script exit)

You probably didn't notice, but it will have to hit a few gigs of ram until it crashes like above.

from imageput.

iseahound avatar iseahound commented on September 21, 2024

Add documentation to delete the buffers

Also, add an update() method to Imageputbuffer (for screen capture only)?

from imageput.

jpuerj avatar jpuerj commented on September 21, 2024

The problems seems to be with ImageSearch. Whenever the function is called the memory use increase a bit. I tested on this hotkey:

F1::
{
static img := ImagePutBuffer("Code")
static search := ImagePutBuffer("images/waypoint_1.png")
loop {
xy := img.ImageSearch(search)
Sleep(100)
}
}

The increase is very small... About 1MB each minute... I think that's why it took more than an hour to crash on my script.

from imageput.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.