Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4622192
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:48:31+00:00 2026-05-22T02:48:31+00:00

I have a problem I cannot solve. Of course here I just expect to

  • 0

I have a problem I cannot solve. Of course here I just expect to have a suggestion that can help me to find a solution.

Basically my application is full of runtime generated TPopupMenuItems (while all the TPopupMenus are hardcoded). In some cases what I do is simply hide/show or enable/disable items, in other cases I create items at runtime.

In some machines only, after leaving the application running for days (2 or more) the popupmenus don’t work anymore correctly.

The behaviour is:

all the TPopupmenu items look are the same, and execute the same action.

The action is the one performed by the first TPopupMenuItem of the application (the first generated at runtime when the application starts, this is the only hint I have).

Imagine in correct scenario I have (in a 3-items-TPopupMenu):

Item23

Item24

Item25

after the problem I see:

Item1

Item1

Item1

(where Item1 is the TPopupMenuItem belonging to another TPopupMenu).

Does this tell you something?

Thanks.

Update:

I tried to look at the code of my popupmenus and I found what could be a common cause, and this explains also why FastMM4 didn’t find this:

   while mnuItem.Count > 0 do
      mnuItem.Delete(0);

Delete (I just read in the documentation) doesn’t free the item, I should call free instead. Anyway when closing the application the main popupmenus are freed correctly, and FastMM4 doesn’t complain. So this is probably the solution, now I don’t know why Delete was used, I didn’t write that code.

Further update:

I tried to make a sample application, I couldn’t reproduce the problem, but for sure I noticed that using this is much more performant (I tried a loop with 10000 recursions):

while mnuItem.Count > 0 do
      mnuItem.Items[0].Free;

I will try for this in my app (but I need to let some days pass to really know if I got the problem, ayway for sure this is a major improvement anyway).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:48:32+00:00Added an answer on May 22, 2026 at 2:48 am

    I confirm that the problem was linked to Delete instead of Free. Popupmenu wsa refreshed every minute on the machines that had the problem (so it was not OS or HW specific, just config specific). Then according to user settings the menu could have 10 to 100 items, so leaving it idle for days made it possible to hit the handle limit.

    By the way it also makes no sense to refresh the popupmenu in that way, so I found also an optimizaion removed a bug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have come across a problem that I cannot see to solve. I have
I have a problem with an MVC view that I just cannot seem to
I have a problem I cannot solve with a Core Data entity. In my
I have this Javascript problem I cannot solve. My code is: <script type=text/javascript> var
I have a problem I cannot seem to solve. I have a php and
I have a problem that is staring me in the face but I cannot
I have a problem where I cannot identify visitors to my intranet page because
I have problem in some JavaScript that I am writing where the Switch statement
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I've been having a problem that's plagued me many times in the course of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.