Copy link to clipboard
Copied
Hello everyone,
I m using OpenCV recently to do a lot of computation.
The main problem is that I need to replace the OpenCV memory allocation by After effect "host_new_handle" calls.
This work pretty well in a lot of situation but i think I bumped into a problem.
I m trying to allocate a 1920*1080 size image of 3 channel, 32 bits, but 12 times at once.
so the memory size I m trying to allocate through new_handle is around 300Mb.
And it raises an error.
I m wondering if anyone knows about a limit of maximum memory that After Effects may allow at once.
Copy link to clipboard
Copied
AE is supposed to allow you to allocate all the available ram.
no limit other than that.
in one of my plug-ins i allocated over over 500mb per frame.
needless to say that it made the ram previews very very short.
before optimizing the plug-in to eventually use 1/100th the ram, there was one thing that rally helped:
i broke my ram allocation down to smaller blocks.
when you ask for 300mb of ram, you're asking for a single block of 300mb.
that amount of ram might be available, but not as a single block.
if you can do your computation on a series of blocks, that might help.
anyways,
unless something has changed in AE since a few years back when i made that monster ram allocation i talked about, you should be able to allocate that amount of ram.
Copy link to clipboard
Copied
Thank you for your answer.
I guess that is my problem: allocating the whole amount as a single block is impossible.
But As openCV images are considered as single block of memory... I may not be able to circumvent it without getting deep into the source...
Copy link to clipboard
Copied
If you are using C interface you can allocate the header with OpenCV, cvCreateImageHeader (little of system memory) and allocate imageData with suites, or, for some operations, even use layer data!
greets
Copy link to clipboard
Copied
that s what i did, but the amount of memory i tried to allocate at once with host_new_handle seemed to be to large and crashed,
Because imageData of opencv is just as a single block.
Copy link to clipboard
Copied
you can try a couple of options
a) use AEGP_NewMemHandle from memory suite
b) allocate with C runtime, despite what the docs say...
Now if you allocate a lot of ram for frame data, there only danger to that is that AE would compete with the plugin for memory, your system may be come slow and swap to disk a lot. You have to test it with ammount of RAM your target system has, you might get away with that!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more