Groups > Application developers > Photoshop SDK > Re: Allocating high amount of memory




Allocating high amount of memory

Allocating high amount of memory
Tue, 12 Feb 2008 03:47:23 -080
Hi,

my plug in needs a lot of memory. Round about 100MB or a little bit more.
The reason for this is that there are a lot of calculation steps and I need to
store the results in between for caching and faster processing.

How do I allocate such amount of memory?
Are there any tricks or hints?

I have the problem that I can oben the plugin 3-5 times and then photoshop
crashes. (It crashes because the buffer suit allocation function cannot allocate
more memory and my plugin do not handle this yet.)
Means photoshop cannot allocate more memory. It seems it doesn't free unused old
memory even when I explicitely free it via buffer suit.

Any held welcome.

Post Reply
Re: Allocating high amount of memory
Tue, 12 Feb 2008 07:05:27 -080
ThomasTh@adobeforums.com wrote:

> I have the problem that I can oben the plugin 3-5 times and then photoshop
crashes. (It crashes because the buffer suit allocation function cannot allocate
more memory and my plugin do not handle this yet.)
> Means photoshop cannot allocate more memory. It seems it doesn't free
unused old memory even when I explicitely free it via buffer suit.

It sounds more like a heap fragmentation problem. It may have 200meg free but 
may not have a contiguous block of 100meg that you requested.

-X
-- 
for photoshop scripting solutions of all sorts
Post Reply
Re: Allocating high amount of memory
Tue, 12 Feb 2008 07:48:28 -080

      It sounds more like a heap fragmentation problem.




So what do you suggest?
Allocating small blocks?
My current code does the exact opposite. E.g. all U8-datas (think several layers
of U8-data) are combined to one big U8-array to have only one allocation for
it.

Post Reply
Re: Allocating high amount of memory
Tue, 12 Feb 2008 13:39:53 -080
ThomasTh@adobeforums.com wrote:
> 
>       It sounds more like a heap fragmentation problem.
 >
> So what do you suggest?
> Allocating small blocks?

If it really is a fragmentation problem, that would be the best solution.

> My current code does the exact opposite. E.g. all U8-datas (think several
layers of U8-data) are combined to one big U8-array to have only one allocation
for it.
> 

I thought it might be something like this. It will add some complexity to your 
code but it may be the only way to get the job done.

-X
-- 
for photoshop scripting solutions of all sorts
Post Reply
Re: Allocating high amount of memory
Fri, 29 Feb 2008 05:01:29 -080
FYI:
I changed memory handling to more smaller pieces instead of large blocks of
memory.
It seems to work now. But there is an interessiting side effect:
Post Reply
about | contact