473,790 Members | 2,514 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Memory allocation failure

Hello all,

I am writing a Photoshop plug-in on Windows, and I am having trouble
with allocating memory. Essentially, the code performs a very complex
operation on the image, so 9 buffer planes are required as scratch
memory. The problem occurs when the image that a user tries to process
is big, say 10 mega pixels or more. A Photoshop error pops up saying
"Could not complete the command because of a program error".

The error occurs in Photoshop's memory allocation routine,
'FilterRecord->bufferProcs->allocateProc '. It simply fails, hence the
problem must be allocating the memory. So I tried to replace this with
a call to a good old malloc, but trying to allocate the 9 planes
fails, because malloc returns a NULL pointer.

Now the weird thing is that processing a single 10MB will fail,
whereas I can process seven or eight 8MB images without a complaint
from Photoshop. Furthermore, with those seven or eight 8MB still open
in Photoshop, I can process a 20MB image with a command-line
equivalent of the plug-in. So in a nutshell, there is enough memory
as I can allocated twice more memory than what fails in Photoshop, so
what is going on? I could maybe understand that the Photoshop function
refuses to allocate such memory for some reasons, but why does the
malloc in the plug-in fail?! Especially since the malloc in the
command-line equivalent succeeds without a problem for an image TWICE
bigger?!

I would greatly appreciate any comments/ideas/suggestions.

Thanks in advance

Alex

May 22 '07 #1
1 4015
On 22 May 2007 01:49:08 -0700, vectorizor <ve********@goo glemail.com>
wrote:
>Hello all,
snip Photoshop discussion
>
Now the weird thing is that processing a single 10MB will fail,
whereas I can process seven or eight 8MB images without a complaint
from Photoshop. Furthermore, with those seven or eight 8MB still open
The fact that "small" allocations succeed while a "large" fails may
indicate nothing more sinister that memory fragmentation. (How many
pieces of kindling will fit through your front door vs how many full
grown redwoods?)
>in Photoshop, I can process a 20MB image with a command-line
equivalent of the plug-in. So in a nutshell, there is enough memory
as I can allocated twice more memory than what fails in Photoshop, so
what is going on? I could maybe understand that the Photoshop function
This would seem to indicate that when Photoshop is active it does
something "strange" to the virtual memory in that task. As with most
virtual memory systems, each task has its own memory and whatever
Photoshop did with its is not affecting your command line task.
>refuses to allocate such memory for some reasons, but why does the
malloc in the plug-in fail?! Especially since the malloc in the
command-line equivalent succeeds without a problem for an image TWICE
bigger?!

I would greatly appreciate any comments/ideas/suggestions.
You really need to discuss this in a Photoshop newsgroup. You have
demonstrated that the problem is not likely in your C code or the C
run time library. Does Adobe provide any kind of tech support?

An alternative design, obviously slower but available immediately, is
to use files instead of allocated memory.
Remove del for email
May 22 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3378
by: Koen | last post by:
Hi! What is the method you use to handle memory allocation failure in C++ using the "new" operator? I used to only check if a NULL pointer is returned after the "new" call, but that's probably only working in MSVC++. I also read about the "bad_alloc" exception, but that doesn't seem to be thrown by MSVC++. Now, one could of course say "don't use MSVC++", but I'd rather like to hear a good solution for being able to handle memory...
4
2090
by: kk | last post by:
Hi all, i didn't get output in the following code while compiling and executing with g++ version 3.2.3 it doesn't allocate memory to pointer varaible (x) in class B. and it gives correct output while executing in .Net and visual slick editor. why it didn't allocate memory? if anybody knows plz give reply. thanks in advance kk
16
2520
by: Jacob | last post by:
It is common practice (I've heard) to always catch allocation exceptions from "new". How is done in practice? What would be a common procedure (path of sequence) after such an event has occured? (For a multi-million LOC, GUI based application). It is also a common advice not to allocate objects with "new" unless absolutely required. The alternative is to keep objects on the stack, automatically allocated and deallocated by scope...
4
6771
by: PaulR | last post by:
Hi, We have a Server running SLES 8 and 3GB memory, with 1 DB2 instance and 2 active Databases. General info... DB2level = "DB2 v8.1.0.72", "s040914", "MI00086", and FixPak "7" uname -a = Linux galahad 2.4.19-64GB-SMP #1 SMP /etc/sysctl.conf kernel.shmmax=268435456
3
2580
by: Hassan Iqbal | last post by:
Hi, (1)if i do the memory allocation like: int **p; p= malloc(n*sizeof p); for(i=0;i<n;i++) /* i and n are integers */ p= malloc(n*sizeof p); then in that case is this command sufficient to free all the allocated memory:
8
4756
by: clsmyth | last post by:
Folks, Hi, I have never posted to a language group before so please excuse me if this is inappropriate. I have posted this to comp.unix.solaris (well, I am one of the folks on the thread at least)...the subject is "4 GB hard constraint on a Solaris 8 server". I figured I'd post over here because we aren't getting anywhere too fast over there, and I think it is a code issue. We have a piece of software that we purchased. It is a...
66
3645
by: Johan Tibell | last post by:
I've written a piece of code that uses sockets a lot (I know that sockets aren't portable C, this is not a question about sockets per se). Much of my code ended up looking like this: if (function(socket, args) == -1) { perror("function"); exit(EXIT_FAILURE); } I feel that the ifs destroy the readability of my code. Would it be
17
9151
by: dtschoepe | last post by:
Hi, I have a homework project I am working on, so be forwarned, I'm new to C programming. But anyway, having some trouble with a memory allocation issue related to a char * that is a variable inside of a structure. I keep getting segmentation fault errors and I am having trouble understanding why. Here's the parts of the code in question... This is part of the .h file where the struct us defined...
0
4448
by: kumar | last post by:
HI, I am constantly getting below error. I search on internet but didn't get any help, I would really appreciate if anyone can help me in resolving this issue. I am using DB2 V9.1 and OS is solaris. 2008-01-02-20.32.28.757252-480 I3728A679 LEVEL: Severe (OS) PID : 12724 TID : 1 PROC : db2fmp INSTANCE: sample NODE : 000 FUNCTION: DB2 UDB, SQO Memory Management, sqlocshr2, probe:200
10
4430
by: swornavidhya.mahadevan | last post by:
Which allocation (Static / Dynamic) is suitable for the situation when we are trying to allocate for a overloaded memory when the memory is full and no space to allocate. What will happen if both the allocation is impossible. Sworna vidhya
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.