Is it okay to use C++ new, delete in a plugin these days?

Are C++'s new and delete operators totally kosher, not a time bomb that'll crash for some user two months from now?   The documentation I found says to ask Photoshop for memory through an awkward API, but then all documentation and sample plugin code I've found so far are old.   In years past, I've worked in programming environments where one had to get handles and then get pointers - the old Win32 API comes to mind - but eventually the makers of such environments said to just go ahead and use malloc() and free(), or new and delete, and it was fine.  
Maybe it's likewise for the PS CS5 SDK?
I just finished developing a Format plugin for CS5 on 64-bit Mac, using C++.  (No 32-bit, no Microsoft, no older CS[n].)   It works fine, no crashes or complaints so far.   To facilitate processing, it allocates memory and objects using new during handling of formatSelectorReadStart and deletes it during formatSelectorReadFinish.   So it seems okay. But of course "it runs on my machine okay" is not sound reasoning.

Yes, it is ok to use new and delete.
It is recommended to use Photoshop memory routines for *large* memory requests.
Photoshop (via user settings in preferences) and the system have already had a discussion about memory usage and if you go and ask the OS for large amounts of memory you are more likely to run into thrashing and unhappy users. Having said all that, I see you are 64 bit mac! So thrashing is far less of an issue in that world.
We used to over ride new and delete in the SDK examples and that was a BIG mistake. As you cannot guarantee when the over ride occurs and if libraries are using new and delete your over ride and on and on and it is a true mess! Don't do it.

Similar Messages

  • Is it okay to use your new iPod Touch before charging it for the first time? I did and then listened to it while charging and syncing. Thanks

    Just got the 5G Touch. I turned it on and was using the camera and stuff before I charged it for the first time. Then while charging, I listened to the music I was syncing through the speakers. This okay? I remember reading to always charge full before ever doing anything on them. Doesnt say anything in the startup manual though.
    Thanks guys.

    Should be OK. Just make sure that the iPod is charging.

  • New Bootstrap 3 Navbar plugin for BC Community.

    Hello everyone!
    I have just finished creating a plugin that will set up all the settings in order to make Bootstrap Navbar work without having to hassle with CSS & Javascript, or having to
    add the class "dropdown" for each dropdown menu inside Dynamic Menu manager at the backend. It also lets you to choose between toggle and hover on the dropdown menu. So if you client changes his/her mind you just
    change the property "dropdownToggle" to false.
    If you can optimise to speed it up feel free to do so, just make sure you share it here afterwards.
    Download the plugin here http://www.it-amigo.se/LiteratureRetrieve.aspx?ID=131498
    Instrucitons
    Just add the plugin as any JQuery plugin and then add the following code to your html document.
    $('#top_navbar').bootstrapNav({
        // Dropdown Choice: Toggle(Bootstrap Default) = true, Hover Dropdown = false.
        dropdownToggle: true,
        // At what point should navbar go back to Toggle for Mobile Devices.
        breakpoint: 1199
    Tutorial Video

    Ya you are correct. A good CSS3 Code and JQuery code and do the same thing. :-D
    About the bug i was talking about sometimes was that even if you had the css & javascript correct, if you held your finger on a dropdown menu for more then 2 seconds the dropdown kept showing up. I followed the steps from bcgurus and the end result was always the same. After a while i got frustrated thats why i went down this road and went with a JQuery plugin.
    The worst part was when the client had it so hard to decide between toggle and hover and others wanted the top & second level menus to be clickable.
    How come you don't use many plugins these days, they are awesome. Googles Polymer is seems to go down this road.. i mean build sites with many different of plugins / modules.

  • Okay..I've been trying to fix this for DAYS now!  When I sign in (under settings) w my new apple ID, then go to update or purchase something I cannot get the new apple ID to come up.  It's still using the old one (which is disabled) ..please help!

    Can someone pls help me??  Okay..I've been trying to fix this for DAYS now!  When I sign in (under settings) w my new apple ID, then go to update or purchase something I cannot get the new apple ID to come up.  It's still using the old one (which is disabled) ..please help!

    Delete what? The ID's? They cannot be deleted - you just quit using it.
    If you still have one old ID - that you have purchased content with - you are saying that the password no longer works with that ID? Did you try to reset the password for that ID?
    Read this - instructions if the ID was disabled for entering the wrong password.
    http://support.apple.com/kb/TS2446?viewlocale=en_US&locale=en_US
    If it gets too involved - you can always contact support.
    http://www.apple.com/support/appleid/
    Just do not create another ID!

  • I have forgotten icloud account password linked to my ipad. I am unable to reset the password as well as delete this account from my ipad, and use a new one.

    I have forgotten icloud account password linked to my ipad. I am unable to reset the password as well as delete this account from my ipad, and use a new one.                                  

    None of us here, nor Apple, can help you.

  • How can I use a new computer without deleting everything on iPod?

    Hey Guys
    I need a bit of help.
    My old computer died, it was running Windows XP. I've got myself a new computer running Windows 7.
    I have a copy of my iTunes folders from my old computer (taken 2 days before it died)
    How can I use a new computer without deleting everything on iPod touch?
    I've imported all the folders (music, apps etc) into the new computer's iTunes, but when I sync my iPod
    I receive a window asking if i want to sync i need to erase and replace with the iTunes library on the computer.
    I particularly don't want to do this.
    My wife also uses my iTunes for her iPhone.
    Any help would be appreciated. Thank you

    Make a backup of the iPod by connecting the iPod to the computer and right clicking on the iPod under Devices in iTunes and selecting Backup. Then restore the iPod from that backup and sync as necessary.

  • Me and my sister were  using the same apple id but know i'm using a new one and i want to change also the icloud account but i'm afraid if i deleted the icloud account it would be also deleted from her iphone, so can i delete it ?

    me and my sister were  using the same apple id but know i'm using a new one and i want to change also the icloud account but i'm afraid if i deleted the icloud account it would be also deleted from her iphone, so can i delete it ?

    You can delete it.

  • Trying to use a new, larger external hard drive for my Time Machine backup.  However, every time I start the backup, it gets started then fails.  And, I can't delete the few files that did save on the external.  Sort of a catch 22.  Any ideas?

    Trying to use a new, larger external hard drive for my Time Machine backup.  However, every time I start the backup, it gets started then fails.  And, I can't delete the few files that did save on the external.  Sort of a catch 22.  Any ideas?

    Is it a USB hard drive?  USB hard drives have the problem of not giving full speed if they are hooked up on the same bus as keyboards and mice.  Double check your profiler to make sure that is not a problem.  If it is Firewire, make sure there aren't other firewire devices in use at the same time.  I recommend not only keeping a Time Machine backup, but also a clone, and if you do use Time Machine, to make sure the Time Machine drive or partition is at least twice the size of the original drive.

  • I have a ipod shuffle synced to a desktop (ver 9), I have a new laptop and downloaded itunes (ver 10.7).  When i plug the ipod in the new laptop it wants to delete my songs. How do i use my new alptop and ipod together?

    I have a ipod shuffle synced to a desktop (ver 9), I have a new laptop and downloaded itunes (ver 10.7).  When i plug the ipod in the new laptop it wants to delete my songs. How do i use my new alptop and ipod together?

    Your iPod is designed to sync with only one iTunes library at a time.  It will recognize the iTunes library on the PC as a new library.  If you sync the iPod with this new library, all content will be erased from the iPod and replaced with what is in the new library.  So what you will want to do is copy everything from the iPod to your new iTunes library on your PC first.
    See this excellent user tip from another forum member turingtest2 outlining the different methods and software available to help you copy content from your iPod back to your PC and into iTunes.
    Recovering your iTunes library from your iPod or iOS device
    B-rock

  • Yesterday I changed my email password on my home computer.  Today, I can't get any new emails on my Samsung Galaxy 4; I deleted the email account entirely and tried to set it up again as a new account, using the new password, but it keeps giving me an err

    Yesterday I changed my email password on my home computer.  Today, I can't get any new emails on my Samsung Galaxy 4; I deleted the email account entirely and tried to set it up again as a new account, using the new password, but it keeps giving me an error message that reads: Cannot safely connect to server.  The new password is working on my home computer.  I even tried the old password; it just gave me the same error message.

    I'm sorry you're having issues with your e-mail account on your phone Rusty1112. Let's figure out what's going on. First, please try deleting account/information again and then restart phone. When phone is back on, try adding e-mail account again, and be sure you're entering exactly as you set up, meaning its case-sensitive. If you're still getting same error, please let us know and let us know what e-mail account it is, Yahoo, AOL, MSN, etc.
    Thank you,
    VanessaS_VZW
    Follow us on Twitter @VZWSupport

  • I deleted all my photos and videos and then delete the deleted files but the photo app is still taking up 12 GB of space and I have no room for new stuff.  How can I clear the memory space used by my deleted videos and photos?

    I deleted all my photos and videos and then delete the deleted files but the photo app is still taking up 12 GB of space and I have no room for new stuff.  How can I clear the memory space used by my deleted videos and photos?  I don't know why the photos are still taking up space and if I will have to reset my phone to get rid of the problem.

    Hey there TowneJ,
    Welcome to Apple Support Communities.
    The article linked below provides troubleshooting tips that’ll likely resolve the issue that you’ve described, where deleted files appear to be taking up space on your iPhone 5.
    If you get a "Not enough free space" alert on your iPhone, iPad, or iPod touch - Apple Support
    So long,
    -Jason

  • Ipod Touch 4-How to recover deleted data?I have not backed it up in itunes as I am using a new laptop

    Ipod Touch 4-How to recover deleted data?
    I need valuable information which was deleted.
    I  have not backed it up in itunes as I am using a new laptop.
    Plz help

    Thanks for the reply.
    These softwares recovery softwares recover data from external devices which are shown as drives.As far as I know the recent Ipods dont have an option to be shown as a drive.
    Any particular data recovery software available for ipod touch 4?
    Any hepl in this regard would be highly appreciated!

  • :NEW cannot be used in After Delete Trigger ?

    Hi,
    Is there any way to get the :NW.value in the After delete trigger for each row. My requirement is audit log of the end user DML operations along with user Name (HERE THE USER IS NOT THE ORACLE USER, BECAUSE OF THE LARGE NUMBER OF END USERS WE ARE MAINTAINING ONE TABLE TO CREATE USER NAME & PASSWORD, WHEN THE USER LOGIN TO ORACLE FORM SCREEN, ASSIGN THE USER NAME TO GLOBAL VARIABLE) & Action Date.
    Here is my code for trigger - It is working fine with INSER & UPDATE but for DELETE User is NULL
    CREATE OR REPLACE TRIGGER Tgr_stud_det
    AFTER INSERT OR UPDATE OR DELETE ON student_details
    FOR EACH ROW
    DECLARE
    BEGIN
    IF Inserting THEN
    -------------INSERT VALUE---------------
    INSERT INTO Log_student_details
    (Seq,
    App_User,
    Action,
    Action_Date,
    stud_name,
    stud_age,
    stud_sex)
    VALUES
    (stud_sequence.NEXTVAL,
    :NEW.App_User,
    'INSERT',
    SYSDATE,
    :NEW.stud_name,
    :NEW.stud_age,
    :NEW.stud_sex);
    -------------DELETE VALUE---------------
    ELSIF Deleting THEN
    INSERT INTO Log_student_details
    (Seq,
    App_User,
    Action,
    Action_Date,
    Comment_Up,
    stud_name,
    stud_age,
    stud_sex)
    VALUES
    (stud_sequence.NEXTVAL,
    :OLD.App_User,
    'DELETE',
    SYSDATE,
    NULL,
    :OLD.stud_name,
    :OLD.stud_age,
    :OLD.stud_sex);
    ELSIF Updating THEN
    -------------UPDATE VALUE---------------
    INSERT INTO Log_student_details
    (Seq,
    App_User,
    Action,
    Action_Date,
    Comment_Up,
    stud_name,
    stud_age,
    stud_sex)
    VALUES
    (stud_sequence.NEXTVAL,
    :NEW.App_User,
    'UPDATE',
    SYSDATE,
    'NEW VALUE',
    :NEW.stud_name,
    :NEW.stud_age,
    :NEW.stud_sex);
    INSERT INTO Log_student_details
    (Seq,
    App_User,
    Action,
    Action_Date,
    Comment_Up,
    stud_name,
    stud_age,
    stud_sex)
    VALUES
    (stud_sequence.CURRVAL,
    :NEW.App_User,
    'UPDATE',
    SYSDATE,
    'OLD VALUE',
    :OLD.stud_name,
    :OLD.stud_age,
    :OLD.stud_sex);
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END Tgr_stud_det;
    Thanks in advance.

    Rizly,
    As i mentioned in the above post, you should remove the references of :old and :new when you are trying to use the global variables. These values are only significant when you the talk about the record in the table.
    For the scenario, you explained, your trigger would insert two records....The trigger would be fired twice.. once during the insert and once during the delete. The audit table will have two records indicating both the actions..
    Take a look at this example below...I am artificially manufacturing a user id in the package test_pkg and using that in the insert trigger. As i explained above, you dont need the :old and :new references because the user id is not a column in the table . hence the :old and :new references have no relevance.
    Also note that, for the delete, I use the :old value and for the insert, I use the :new value.
    for update, I assume you want to store the old record and hence used :old (you can of course use :new too..technically.).
    I don't have access to a forms environement, but the user id logic should be similar to what I described below.
    sql> create table t(
      2     id number,
      3     name varchar2(20)
      4  );
    Table created.
    sql> create table t_audit
      2     ( id number,
      3       name varchar2(20),
      4       action varchar2(20),
      5       user_id varchar2(20)
      6  );
    Table created.
    sql> create or replace package test_pkg as
      2      function get_user_id return varchar2;
      3  end test_pkg;
      4  /
    Package created.
    sql> create or replace package body test_pkg as
      2      function get_user_id return varchar2 is
      3      begin
      4          return 'USER' || to_char(sysdate,'HH24:MI');
      5      end get_user_id;
      6  end test_pkg;
      7  /
    Package body created.
      1  create or replace trigger trg_biud_t
      2     before insert or update or delete on t
      3     for each row
      4  begin
      5     if INSERTING then
      6        insert into t_audit values (:new.id, :new.name, 'INSERT',test_pkg.get_user_i
      7     elsif UPDATING then
      8        insert into t_audit values (:old.id, :old.name, 'UPDATE',test_pkg.get_user_i
      9     elsif DELETING then
    10        insert into t_audit values (:old.id, :old.name, 'DELETE',test_pkg.get_user_i
    11     end if;
    12* end;
    sql> /
    Trigger created.
    sql> select * from t;
    no rows selected
    sql> select * from t_audit;
    no rows selected
    sql> insert into t values (100, 'Rajesh');
    1 row created.
    sql> insert into t values (200,'Kumar');
    1 row created.
    sql> delete from t where id = 200;
    1 row deleted.
    sql> commit;
    Commit complete.
    sql> select * from t
      2  /
            ID NAME
           100 Rajesh
    sql> select * from t_audit;
            ID NAME                 ACTION               USER_ID
           100 Rajesh               INSERT               USER15:36
           200 Kumar                INSERT               USER15:36
           200 Kumar                DELETE               USER15:37

  • HT5621 I have tried to changed my Apple ID and every time I try to use the new Apple ID it won't let me because when i try to update an app the old ID comes up to sign in.  I deleted that account so it will not let me use my new one.

    I have tried to changed my Apple ID and every time I try to use the new Apple ID it won't let me because when i try to update an app the old ID comes up to sign in.  I deleted that account so it will not let me use my new one.

    Content and Apple IDs -
    Content is forever tied to the Apple ID that bought it. Apple does not transfer content from one Apple Id to another. Apple does not merge Apple IDs. You will never be able to access your content bought with another Apple ID with a new ID.

  • TS3274 Deleting Disabled AppleID and using a new that works with apps gotten with disabled apple ID

    I gave my iPad 2 to someone to download some apps for me.The guy used his apple ID to download the apps.the apple ID used is now disabled. I want to be able to use my new apple ID to update all apps downloaded including the ones downloaded using the initial ID.

    Content is tied to the account that originally downloaded/bought it, and it can't be copied or transferred to a different account - delete the apps that weren't downloaded with your account and then buy/download your own copies of them

Maybe you are looking for