Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Error: Could not allocate memory for environment block


This question is answered.


Permlink Replies: 5 - Last Post: Nov 29, 2017 9:27 AM Last Post By: Garrett B
Garrett B

Posts: 77
Registered: 10/2/16
Error: Could not allocate memory for environment block  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 23, 2017 12:53 PM
Apology: I did not know which category to post this question under.

Hi

I am looking for some general pointers on where to begin understanding the following...

When I run my application, I get the following pop-up message (after one hour!):

Could not allocate memory for environment block

My application is essentially running the same routine every 2 seconds, so I assume that something in this loop is starting/creating something that it is not finishing/destroying...

So my question(s) are:

Can anyone tell me what this message means?
If it is something to do with a memory leak, can you point me to where I could learn more about this?

Thanks

Garrett
Andy Walker

Posts: 72
Registered: 1/20/01
Re: Error: Could not allocate memory for environment block  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 24, 2017 2:47 AM   in response to: Garrett B in response to: Garrett B
Might be helpful if you can post your code Garrett?

Andy

Garrett B wrote:
Apology: I did not know which category to post this question under.

If it is something to do with a memory leak, can you point me to where I could learn more about this?

Thanks

Garrett
Garrett B

Posts: 77
Registered: 10/2/16
Re: Error: Could not allocate memory for environment block  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 24, 2017 8:28 AM   in response to: Andy Walker in response to: Andy Walker
Hi Andrew - thanks for the reply

Essentially a timer expires every 3 seconds and runs a small bit of code.
It involves calling 3rd party library functions from STW Technic, so I can't see much under the hood just yet.
I do intend to contact them, but I really just wanted to understand what the error message means - does it mean a memory leak?

Thanks

Garrett

Edited by: Garrett B on Nov 24, 2017 8:28 AM
Alex Belo

Posts: 626
Registered: 10/8/06
Re: Error: Could not allocate memory for environment block [Edit]
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 24, 2017 9:54 PM   in response to: Garrett B in response to: Garrett B
Garrett B wrote:

I really just wanted to understand what the error
message means - does it mean a memory leak?

Yes, it can be. Or leak of some other OS resource.

Open task manager, add additional columns (like number of threads,
descriptors etc.) and see if memory or any other resource grows.

--
Alex
Garrett B

Posts: 77
Registered: 10/2/16
Re: Error: Could not allocate memory for environment block [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 28, 2017 1:39 PM   in response to: Alex Belo in response to: Alex Belo
Thanks Alex - that sent me on the right path

Garrett
Garrett B

Posts: 77
Registered: 10/2/16
Re: Error: Could not allocate memory for environment block [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 29, 2017 9:26 AM   in response to: Garrett B in response to: Garrett B
For anyone else who gets this - this is what I discovered with my application:

My code was frequently loading/unloading DLLs, and apparently there is a known issue with C++ Builder that causes memory leaks when unloading DLLs.

The solution / workaround is apparently to keep the loading/unloading to a minimum.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02